Maybe your signal is finite, but the function you are transforming is infinite. So you can do your demonstration using the interval $[0,T]$ or $[-\infty,+\infty]$, the result should be the same, because if your signal is finite the FT threats it as an infinite signal with period T.
Is it possible to isolate g(t)?
No. At least not if you mean by "isolate", "can I calculate $g(t)$ from $S(f)$"
You can recover $g(t)$ from it's Fourier Transform $G(f)$. This is related to the power spectrum through
$$S(f) = |G(f)|^2$$
So you can get the magnitude of $G(f)$ but not the phase. Information is lost and you cannot recover $...
If there was some code outlining this, I would be interested
I don't have the expertise to describe pYin precisely, but I can point you to the original code for that paper https://code.soundsoftware.ac.uk/projects/pyin/repository
There's also a more recent implementation which made it into the librosa library since this question was asked. The code and pull ...