First: the objects in question are not literally equal: the elements of $(M_1\coprod M_2)/(N_1\coprod N_2)$ are congruence classes of elements of $M_1\coprod M_2$ modulo the submodule $N_1\coprod N_2$; in particular, they are sets of elements of $M_1\coprod M_2$; that is, sets of ordered pairs $(m_1,m_2)$, with $m_1\in M_1$ and $m_2\in M_2$.
By contrast, the elements of $\frac{M_1}{N_1}\coprod \frac{M_2}{N_2}$ are pairs of elements, one in $\frac{M_1}{N_1}$ and one in $\frac{M_2}{N_2}$; these are themselves sets of elements of $M_1$ and of elements of $M_2$, respectively.
So, the elements of $(M_1\coprod M_2)/(N_1\coprod N_2)$ are sets of pairs of the form $(m_1,m_2)$.
The elements of $(M_1/N_1)\coprod (M_2/N_2)$ are pairs $(S,T)$, where $S$ is a subset of $M_1$ and $T$ is a subset of $N_2$.
So one is a set of sets of pairs, the other is a set of pairs of sets. Different objects. You are blurring this distinction in your second and third steps.
So you don't have equality, but you may have isomorphism.
Second: the fact that you are using $\coprod$ instead of $\times$ or $\oplus$ suggests that you should focus instead on the properties of these objects rather than any specific construction.
Namely: the object $A\coprod B$ is an object, together with two morphisms $i\colon A\to A\coprod B$ and $j\colon B\to A\coprod B$, with the property that for every module $X$ and every pair of morphisms $f\colon A\to X$ and $g\colon B\to X$, there exists a unique morphism $F\colon A\coprod B\to X$ such that $f=i\circ F$ and $g=j\circ F$.
The object $A/N$ together with the morphism $\pi\colon A\to A/N$ is the object with $N\subseteq \mathrm{ker}(p)$ with the property that for every object $B$ and every morphism $f\colon A\to B$, if $N\subseteq \mathrm{ker}(f)$, then there exists a unique $\overline{f}\colon (A/N)\to B$ such that $f = \overline{f}\circ \pi$.
Now, let $M_1$ and $M_2$ be modules, and $N_1$, $N_2$ submodules of $M_1$ and $M_2$, respectively. We can map $M_1$ to $(M_1/N_1)$, and from $(M_1/N_1)$ to $(M_1/N_1)\coprod (M_2/N_2)$. Likewise, we can map $M_2$ to $(M_2/N_2)$ and from $(M_2/N_2)$ to $(M_1/N_1)\coprod (M_2/N_2)$.
This gives us a pair of maps, one, let's call it $\pi_1$ from $M_1$ to $(M_1/N_1)\coprod (M_2/N_2)$; and one, let's call it $\pi_2$, from $M_2$ to $(M_1/N_1)\coprod (M_2/N_2)$. By the universal property of the coproduct, we therefore have a unique morphism $\Pi\colon M_1\coprod M_2\to (M_1/N_1)\coprod (M_2/N_2)$, such that $\Pi\circ i = \pi_1$ and $\Pi\circ j = \pi_2$.
Note that $\Pi$ is onto: this follows because $(M_1/N_1)\coprod (M_2/N_2)$ is generated by the images of $M_1/N_1$ and of $M_2/N_2$ inside the coproduct. Since the map $M_1\to M_1/N_1$ and the map $M_2\to M_2/N_2$ are both onto, then $\langle \pi_1(M_1),\pi_2(M_2)\rangle$ contains the images of $(M_1/N_1)$ and of $(M_2/N_2)$, and therefore the image of $\Pi$ is all of $(M_1/N_1)\coprod(M_2/N_2)$.
By the First Isomorphism Theorem, we conclude that $\frac{M_1\coprod M_2}{\mathrm{ker}(\Pi)} \cong \frac{M_1}{N_1}\coprod\frac{M_2}{N_2}.$
The above is valid, for example, in the category of Groups (with the free product in stead of the coproduct); for the case of modules, we can explicitly describe the kernel:
What is $\mathrm{ker}(\Pi)$? It is exactly $N_1\coprod N_2$. Indeed, it certainly contains the image of $N_1$ and the image of $N_2$; and given any object $(m_1,m_2)\in M_1\coprod M_2$, we have that $\Pi(m_1,m_2) = (m_1+N_1,m_2+N_2)$, which is equal to the zero element of $(M_1/N_1)\coprod (M_2/N_2)$ if and only if $m_1+N_1 = N_1$ and $m_2+N_2=N_2$, if and only if $m_1\in N_1$ and $m_2\in N_2$, if and only if $(m_1,m_2)\in N_1\coprod N_2$.
P.S. The isomorphism is much more natural if you view the objects as products rather than coproducts: we can map $M_1\prod M_2$ to both $M_1/N_1$ and to $M_2/N_2$, so that induces a map $M_1\prod M_2\to (M_1/N_1)\prod (M_2/N_2)$; the map is onto, and the kernel is precisely $N_1\prod N_2$. This holds in Groups as well.