I've been reading about the Mayer-Vietoris sequence, but I don't follow a certain naturality condition.
Suppose two spaces can be written as $X=X_1^\circ\cup X_2^\circ$ and $Y=Y_1^\circ\cup Y_2^\circ$. If $f$ is a continuous map such that $f(X_1)\subset Y_1$ and $f(X_2)\subset Y_2$, then the following composites are the same: $$ H_n(X)\stackrel{D}{\to}H_{n-1}(X_1\cap X_2)\stackrel{g_*}{\to}H_{n-1}(Y_1\cap Y_2) $$ and $$ H_n(X)\stackrel{f_*}{\to}H_n(Y)\stackrel{\Delta}{\to}H_{n-1}(Y_1\cap Y_2) $$
where $D$ and $\Delta$ are the connecting homomorphisms, and $g$ is the restriction of $f$.
From what I understand, the connecting homomorphisms $D=dh^{-1}_*q_*$ where $d$ is the connecting homomorphism for $(X_1,X_1\cap X_2)$, and $h\colon (X_1,X_1\cap X_2)$ and $q\colon (X,\emptyset)\to (X,X_2)$ are inclusions. Similarly, $\Delta=d'h'^{-1}_*q'_*$ Writing out what the maps do to some class $z+B_n(X)$, I end up with $d'(h'^{-1}qf(z)+B_n'(Y))$ and $g_*(dh^{-1}q(z)+B_{n-1}(X_1\cap X_2))$, but it's not clear to me that these are the same.
The theorem you are looking for is the naturality of the connecting homomorphism in long exact sequences of homology groups.
In your case, you start with a diagram $$ \require{AMScd} \begin{CD} 0 @>>> C_*(X_1\cap X_2) @>>> C_*(X_1)\oplus C_*(X_2) @>>> C_*(X_1+X_2) @>>>0\\ & @VVV @VVV @VVV\\ 0 @>>> C_*(Y_1\cap Y_2) @>>> C_*(Y_1)\oplus C_*(Y_2) @>>> C_*(Y_1+Y_2) @>>>0\\ \end{CD}. $$ The rows here are the short exact sequences of chain complexes that induce the Mayer-Vietoris sequences for $X$ and $Y$.
Figure out the vertical maps and convince yourself the 2 squares commute, then the naturality of the connecting homomorphism is exactly the commuting square you are looking for.