We form $X$ by attaching a $3$-cell to $S^2$ by a degree $2$ map, and form $Y$ be attaching a $3$-cell to $S^2$ by a degree $4$ map. I am trying to find out whether the identity $S^2 \to S^2$ extends to a map $Y \to X$. I have already showed that it doesn't extend to a map $X \to Y$ because the induced map $\mathbb{Z} \cong H_2(S^2) \to H_2(Y) \cong \mathbb{Z}/4$ sends $2$ to $2$, but if it factored as $H_2(S^2) \to H_2(X) \to H_2(Y)$, it would have to send $2$ to $0$ because $H_2(X) \cong \mathbb{Z}/2$. No such obstruction exists when considering $Y \to X$.
I feel such a map couldn't exist since you can't "unravel" $Y$ to only a double twist. But, I can't find an obstruction. Any help would be appreciated. Thanks.
For each integer $k$ write $k:S^2\rightarrow S^2$ for the degree $k$ self-map. Then, since $4\simeq 2\circ 2$ we have a homotopy commutative diagram
$\require{AMScd}$ \begin{CD} S^2@>4>> S^2@>p>>Y\\ @V2 V V @VVid_{S^2} V@VV \theta V\\ S^2 @>2>> S^2@>q>>X \end{CD}
where each row is the cofiber sequence that defines the spaces $X$, $Y$, and $\theta:Y\rightarrow X$ is the induced map of cofibers. The map $\theta$ is clearly what you are looking for.
Let's do this in a bit more detail. First observe that $X$, $Y$ are the topological pushouts in the diagrams $\require{AMScd}$ \begin{CD} S^2@>4>> S^2\\ @Vi V V @VVpV\\ D^3 @>l>> Y \end{CD}$\require{AMScd}$ \begin{CD} S^2@>2>> S^2\\ @Vj V V @VVqV\\ D^3 @>k>> X \end{CD}
where $i=j$ are the boundary inclusions (they are the same map, but we'll assign them different symbols to make clear to which we are referring).
First we note that since the composite $j\circ2:S^2\rightarrow S^2\rightarrow D^3$ is null-homotopic and $i$ is a cofibration, there exists and extension $\underline 2:D^3\rightarrow D^3$ such that $\underline 2\circ i=j\circ 2$. This then gives us a map $k\circ\underline 2:D^3\rightarrow X$ that satisfies
$$(k\circ\underline 2)\circ i=k\circ(\underline 2\circ i)=k\circ (j\circ 2)=(k\circ j)\circ 2=(q\circ 2)\circ 2=q\circ (2\circ 2).$$
Now choose a homotopy $F:2\circ 2\simeq 4$ so that $q\circ (2\circ2)\simeq q\circ 4$. Using again the fact that $i$ is a cofibration we get a homotopy $G:D^3\times I\rightarrow X$ starting at $G_0=k\circ \underline 2$ and satisfying $G_t\circ i= q\circ F_t$ for each $t\in I$. In particular its end map $G_1:D^3\rightarrow X$ now satisfies
$$G_1\circ i= q\circ F_1=q\circ 4.$$
It follows using the that $Y$ is the pushout of the maps $i$ and $4$ that there is an induced map $\theta:Y\rightarrow X$ satisfying
$$\theta\circ p=q\circ id_{S^2},\qquad \theta\circ l=G_1\simeq k\circ \underline 2$$
and the first of these properties is exactly what you are looking for.
It may help you to visualise things if you put the pushout square for $Y$ above the pushout square for $X$ and draw in all the maps we've used.
Finally note that although the identity map of $S^2$ does not extent to a map $X\rightarrow Y$, the degree $2$ map does. You may like to follow the steps we gone through here to write down the map it induces.