Playing with differentials in the way you report, can be done but with some care about the mathematical meaning of the manipulation.
When we write a differential, we should know in advance which are the independent variables the function we differentiate depends on and there is no substitute for it coming from formal manipulations.
Actually, the issue of the independent variables $F$ depends on, has to be solved much before writing differentials: it is the definition $F=U-TS$ which is there for the purpose of encoding the same information contained in $U(S,V)$ into a function of $T=\frac{\partial{U}}{\partial{S}},V$. This is a problem which is solved through a Legendre transform$^*$:
$$
F(T,V) = U(S(T,V),V)-TS(T,V)
$$
where, I have put explicitly the way each quantity has to be interpreted from the mathematical point of view instead as using the sloppy notation $F=U-TS$ often used in the practice. The function $S(T,V)$ is obtained by using the inverse function theorem in connection with the definition $T=\frac{\partial{U}}{\partial{S}}(S,V)$.
Once all this is clear, one can even use the formal manipulation reported in the textbook, but without possibility of confusion about how many and which variables $F$ depends on.
A different way to see why formal manipulations alone are not enough could be the following.
Let's assume that we would define
$$
F(S,V) = U(S,V) -ST(S,V)
$$
where $T=\frac{\partial{U}}{\partial{S}}(S,V)$.
With the same formal manipulation one could "prove" that $F$ is again a function of $T$ and $V$, although we have clarly introduced a function of $S$ and $V$. And only on the basis of such previous knowledge, we can correctly interpret in this case $dT$ as the differential of a function of $S$ and $V$ instead as an independent variable.
($^*$) I am referring to Legendre transforms for sake of simplicity, however, the right tool in thermodynamics is the Legendre-Fenchel transform. The conclusion of the above answer won't be changed by such generalization.