In the Wikipedia article on the t-distribution (https://en.wikipedia.org/wiki/Student%27s_t-distribution), they define the random variable -

$$Y = \frac{(\bar{X} - \mu)}{\frac{S}{\sqrt n}}$$

Where $\bar{X}$ is the sample mean (of a distribution that is normally distributed) and $S$ is the sample standard deviation.

Can we use this fact to derive the kernel of the t-distribution? What I normally do is try to derive the CDF $P(Y < y)$ and differentiate it with respect to $y$ to get the PDF. If we try to do this however, we get -

$$P(Y<y) = P(\bar{X} - \mu < \frac{y S}{\sqrt n})$$

Here, $\bar{X}$ is normally distributed and $S$ is inverse chi-squared. I am having a hard time making progress beyond this. The Wikipedia article I linked uses marginalization over the variance to derive it but I was wondering if we can get it from this route as well.