Let $n=2$, $X=\{*\}$, $(Z,z)=(U(1),-1)$ and $Y=S^1$. We identify $S^2$ and $Y$ with the unit sphere and unit circle in $\mathbb{R}^3$ and $\mathbb{R}^2$ respectively.
Then we can let $f(x,y,z)=e^{\pi i z}$, which is compatible with: $$F((x,y,z),*)=\left( e^{\pi i z},(\frac x{\sqrt{x^2+y^2}},\frac y{\sqrt{x^2+y^2}})\right)$$
Then $F$ induces an isomorphism on second homology groups, so cannot be homotpic to any map which factors through the circle $S^1\times \{(u,v)\}$, for fixed $u,v$.