We know that if $M_i$ is an embedded $C^1$-submanifold of $\mathbb R^{d_i}$ with boundary, $f_1:M_1\to M_2$ is $C^1$-differentiable at $x\in M_1$ and $f_2:M_2\to\mathbb R$ is $C^1$-differentiable at $f(x)$, then $f_2\circ f_1$ is $C^1$-differentiable at $x$ and $$T_x(f_2\circ f_1)=T_{f_1(x)}(f_2)\circ T_x(f_1)\tag1.$$ In fact, if $h\in T_x\:M_1$ and $\gamma$ is a $C^1$-curve on $M_1$ through $x$ with $\gamma'(0)=h$, then \begin{equation}\begin{split}T_x(f_2\circ f_1)h&=(f_2\circ f_1\circ\gamma)'(0)\\&=T_{f(x)}(f_2)(f_1\circ\gamma)'(0)=T_{f(x)}(f_2)T_x(f_1)h.\end{split}\tag2\end{equation}
So, everything is fine. However, please take a look at the following example: Let $d:=d_2$, $\tau>0$ and $v:[0,\tau]\times\mathbb R^d\to\mathbb R^d$ be continuous in the first argument with $$\sup_{t\in[0,\:\tau]}\left\|v(t,x)-v(t,y)\right\|\le c\left\|x-y\right\|\tag3\;\;\;\text{for all }x,y\in\mathbb R^d$$ for some $c\ge0$. Then there is a unique $X^x\in C^0([0,\tau],\mathbb R^d)$ with $$T_t(x):=X^x(t)=x+\int_0^tv(s,X^x(s))\:{\rm d}s\;\;\;\text{for all }t\in[0,\tau]\tag4$$ for all $x\in\mathbb R^d$.
Now take $d_1=1$, $M_1=[0,\tau]$ and assume that $T_t(M_2)=M_2$ for all $t\in[0,\tau]$. Let $x\in M_2$ and take $$f_1(t):=T_t(x)\;\;\;\text{for }t\in[0,\tau].$$ Then it should hold $$\left.\frac{\rm d}{{\rm d}t}(f_2\circ f_1)\right|_{t=0}=T_x(f_2)v(0,x)\tag5.$$ However, this is only well-defined if $v(0,x)\in T_x\:M_2$. How do we know that?
The question you are asking is why, if $v(t,x)\in\Bbb R^d$, it turns out that indeed $v(t,x)\in T_xM_2$, provided that $x\in M_2$. But that follows from the later occurring assumption that the flow of $v$ leaves $M_2$ invariant. So if $f_1(t)=T_t(x)\in M_2$ for all $t\in[0,τ] $, then its tangent vector is automatically also a tangent vector of $M_2$. And this is true for all $v(0,x)$, $x\in M_2$. For other values of $t$ the solution may not exist everywhere, as $τ$ need not be uniform in $x$.
older answer
It is also well-defined if $v_0$ is a number, as in an element of the tangent space of $\Bbb R$ at $t=0$. The composite function is $f_2(\phi(t;0,x))$ where $\phi$ is the flow of the differential equation. $x$ is considered constant. Then the derivative is $$ \frac{d}{dt}f_2(\phi(t;0,x))\big|_{t=0}=T_x(f_2)v(0,x)v_0 $$ where $v(0,x)=T_0(f_1)$ and $v_0\in T_0\Bbb R$.
You are making your life more difficult by having named the time-variant vector field of the ODE also $v$, like the tangent vectors of $TM_1$, and switching from $x\in M_1$ in the general formulation to $x\in M_2$ in the ODE example.