When deriving the power spectral density of stochastic processes, why does taking an expectation allow the $T\rightarrow\infty$ limit to be taken?
It is not the expectation operator that makes sure that the limit exists. The expectation just results in an ensemble average, which we need to obtain a deterministic function $S(f)$ for the power spectrum.

Assume we're given a deterministic power signal $x(t)$, i.e., a signal with finite non-zero power, and, consequently, infinite energy. Its Fourier transform generally doesn't exist. We can define a truncated Fourier transform

$$X_T(\omega)=\int_{-T}^Tx(t)e^{-j\omega t}dt\tag{1}$$

By assumption, $\lim_{T\to\infty}X_T(\omega)$ doesn't exist. However, the limit

$$\lim_{T\to\infty}\frac{\left|X_T(\omega)\right|^2}{2T}\tag{2}$$

exists because of the finite power assumption, and this is also the way the power spectrum is defined for such deterministic power signals.

If $x(t)$ is modeled as a random signal, we only need to modify $(2)$ by taking the expectation of the numerator to obtain the power spectrum of $x(t)$.