The correct definition of a function require not only a ''rule'' $f(\cdot)$ that gives a value $y=f(x)$, but also a set $X$ that is the domain of the function (and a set $Y$ that is its codomain)
$$ f:X\to Y \qquad y=f(x) $$
now, if $x$ is a function of some other variable $t$ this function is: $$ g:T\to X \qquad x=x(t)=g(t) $$
and, if we want the composite function $f(x(t))=f(g(t))$ to have the same domain of the original $f$ than $g$ must be a surjective function.