What is the weakest set of assumptions on a pair of spaces $X\subset M$ for which the second homotopy group $\pi_2(M,X) $ is guaranteed to be Abelian?

Naively, I expected that Abelian $\pi_1(X)$ would do the job. However, there are counterexamples. For example, this thread on math.stackexchange discusses elaborate examples with non-Abelian $\pi_2(M,X)$ and Abelian $\pi_1(X)$ by using certain Eilenberg-MacLane spaces.

A student of mine found a simple graphical argument that (if correct) suggests that if

$\pi_1(X)$ is Abelian, and

$X$ is homotopic to a point in $M$

then $\pi_2(M,X)$ is indeed Abelian. This already covers all the physics applications that we have in mind. Nevertheless, it left us wondering how much can one relax the two conditions to still guarantee the commutativity of the relative homotopy group.