I think you can do the following : factor your map $F\colon M_h\to M_{f\circ h}$ as the inclusion $i\colon M_h\hookrightarrow M_h\cup_Y M_f$ followed by a map $q\colon M_h\cup_Y M_f\to M_{f\circ h}$. Then, construct a retract $r\colon M_h\cup_Y M_f\to M_h$. It is then enough to prove that the map $M_h\cup_Y M_f\to M_{f\circ h}$ is a weak-equivalence.
Let us first construct the map $q\colon M_h\cup_Y M_f\to M_{f\circ h}$ and show that it is a weak-equivalence. Consider the pushout diagram defining $M_h\cup_Y M_f$, where $i_0(y)=(y,0)$.
$$\require{AMScd}\begin{CD}
Y@>i_0>>M_f\\
@VjVV@VV\widetilde{j}V\\
M_{h}@>i>>M_h\cup_Y M_f\\
\end{CD}$$
To define $q$, it is enough to define two maps $q_f\colon M_f\to M_{f\circ h}$ and $q_h\colon M_h\to M_{f\circ h}$ such that $q_f\circ i_0= q_h\circ j$.
Set $q_f$ as the composition $M_f\to Z\hookrightarrow M_{f\circ h}$ and define $q_h$ via $q_h(x,t)=(x,t), q_h(y)=f(y)$. This defines the desired map $q\colon M_h\cup_ Y M_f\to M_{f\circ h}$.
Now, $\widetilde{j}$ and $q_f$ are homotopy equivalences, and so $q$ must induce isomorphisms on all homotopy groups. Since $q_{|X}\colon X\hookrightarrow M_{f\circ h}$ is equal to the inclusion, we have that $q$ induces isomorphisms on all relative homotopy groups.
Now, we define $r\colon M_h\cup_Y M_f\to M_{h}$. As earlier, it is enough to define $r_f\colon M_f\to M_h$ and $r_h\colon M_h\to M_h$, such that $r_f\circ i_0=r_h\circ j$. Take $r_h=Id_{M_h}$ and define $r_f$ via : $r_f(y,t)= H(y,t)$, and $r_f(z)=g(z)$. This defines $r$ such that $r\circ i= Id_{M_h}$.
Putting everything together, we have that the composite $M_h\xrightarrow{i} M_h\cup_Y M_f\xrightarrow{r} M_h$ is equal to the identity, and $\pi_n(M_h\cup_Y M_f,X)\simeq \pi_n(M_{f\circ h},X)$. This should imply the result you want.