By the Homomorphism Theorem, any homomorphism $f\colon G\to K$ factors through $G/\mathrm{ker}f$, meaning that there is a map $\hat{f}\colon G/\mathrm{ker}f \to K$ such that $ f = \hat{f}\pi$. The map is indeed $\hat{f}(g\,\mathrm{ker}f) = f(g)$. This applies to the specific case given in Statement 2.
Edit: In fact, the full Statement 1 is not equivalent to Statement 2, in the sense that if you replace $G'$ with an arbitrary subgroup $M$ of $G$ in both statements, then Statement 1 characterizes $G'$, but Statement 2 does not. That is, if you have
Statement 1': If $H\triangleleft G$ and $G/H$ is abelian, then $M\subseteq H$; and if $M\subseteq H$, then $H\triangleleft G$ and $G/H$ is abelian.
Statement 2': If $\varphi\colon G\to A$ is any homomorphism of $G$ into an abelian group $A$, then $\varphi$ factors through $M$; that is, $M\subseteq \ker\varphi$ and there is a homomorphism $\hat{\varphi}\colon G/M\to A$ such that $\varphi(g) = \hat{\varphi}\circ\pi(g)$.
The only subgroup $M$ of $G$ that satisfies Statement 1' is $M=G'$. However, any subgroup of $G'$ that is normal in $G$ will satisfy Statement 2'.
In fact, Statement 2 is equivalent to the first clause of Statement 1, namely that if $H\triangleleft G$ and $G/H$ is abelian, then $G'\subseteq H$, plus the implicit assertion that $G'$ itself is normal in $G$.
Assuming the first clause of Statement 1 plus the fact that $G'\triangleleft G$, if $\varphi\colon G\to A$ is a homomorphism, then by the Homomorphism Theorem, letting $H=\ker\varphi$, then $G/H$ is (isomorphic to) a subgroup of $A$, hence abelian, so we must have $G'\subseteq H = \mathrm{ker}\varphi$; this is Statement 2 (with the final clause of 2 given by the homomorphism theorem as above).
Assuming Statement 2, (which implicitly asserts that $G'$ is normal) suppose that $H$ is a normal subgroup of $G$ such that $G/H$ is abelian. Then considering $\pi\colon G\to G/H$ and applying 2, you conclude that $G'\subseteq \mathrm{ker}\pi = H$. And normality of $G'$ follows from the statement of 2, which requires it.
That is, they aren't quite equivalent, because Statement 1 has another clause, namely the "Conversely..." clause, which is not a consequence of assuming Statement 2. But the first part of Statement 1 (plus "$G'\triangleleft G$") is equivalent to Statement 2.
Added earlier: To see that the two are not quite equivalent as stated, let me give you an example of a subgroup $M$ of $G$ that satisfies Statement 2' but not Statement 1': consider the case of $G=S_4$; then $G' = A_4$. Now let $M = \{ 1, (12)(34), (13)(24), (14)(23)\}$. Then $M\triangleleft G$, and the statement in 2 holds for $M$: given any homomorphism $f\colon G\to A$ with $A$ abelian, the map $f$ factors through $G/M$ and there exists a homomorphism $\hat{f}\colon G/M\to A$ such that $f=\hat{f}\pi$. However, $M$ is not the commutator subgroup of $G$. What is missing in Statement 2 for it to be a true equivalent of Statement 1 is some statement that corresponds to the assertion that $G/G'$ is itself abelian, which is what follows from the "Conversely..." clause in Statement 1. One way to do it is to simply state that $G/G'$ is itself abelian. Another is to consider the intersection of all kernels of all homomorphisms into abelian groups, and say that $G'$ must be equal to that intersection.
Surjective functions can be cancelled on the right:
If $f\colon A\to B$ is surjective, and $g,h\colon B\to C$ are functions such that $g\circ f = h\circ f$, then $g=h$. For, given $b\in B$, there exists $a\in A$ such that $f(a)=b$. Therefore,
$$g(b) = g(f(a)) = h(f(a)) = h(b),$$
so $g(b)=h(b)$ for all $b\in B$, hence $g=h$.
(In fact, this property characterizes surjective functions in set theory).
So suppose that you have two functions, $\overline{\varphi},\overline{\phi}\colon G/N\to H$ such that $\overline{\varphi}\circ \pi = \overline{\phi}\circ \pi$. Since $\pi$ is surjective, this immediately implies that $\overline{\varphi}=\overline{\phi}$.
“How would $\overline{\phi}$ not be unique if $\pi$ wasn’t surjective?” is a counterfactual question.
But...
In general, if $H$ is a proper subgroup of $G$, then there always exists a group $K$ and group homomorphisms $f,g\colon G\to K$ such that $f(h)=g(h)$ for every $h\in H$, but $f\neq g$. A construction is given here.
So if, somehow (complete counterfactual, but whatever), $\pi \colon G\to G/N$ were not surjective, then you would be able to construct a group $H$ and homomorphism $f,g\colon G/N \to H$ such that $f\circ\pi = g\circ\pi$, but $f\neq g$. Letting $\varphi=f\circ \pi$ would give you a map with $N\subseteq \mathrm{ker}(\varphi)$, but with both $f,g\colon G/N\to K$ satisfying the conclusion.
Best Answer
Your claim is false. Take $G$ to be arbitrary and take $H$ to be nontrivial. let $\psi\colon G\to H$ be the trivial map, $\phi(g)=e_H$ for all $g\in G$. Then $\mathrm{Im}(\phi)=\{e\}\triangleleft H$, so the quotient exists. But the map is very nonsurjective.
More generally, if $H$ is any nontrivial group and $N\triangleleft H$ is any proper normal subgroup (they always exist, since you can take $N=\{e\}$) then the embedding $i\colon N\hookrightarrow H$ is non-surjective, but $H/\mathrm{Im}(i) = H/N$ exists.
The real reason your argument fails is that while it is true that your composition has $G$ as the kernel, the isomorphism theorem only guarantees that the image of $\psi\circ\phi$ is isomorphic to $G/\mathrm{ker}(\psi\circ\phi)$. And by construction, that image is trivial, so there is no surprise that $\mathrm{ker}(\psi\circ\phi) = G$. You have no warrant for claiming that the image is all of $G'$. You can require (but did not do so) that $G'$ be equal to the image of $\psi$, but $\mathrm{Im}(\psi\circ\phi)\subseteq \mathrm{Im}(\psi)$, and equality need not hold. We know the equality always holds when $\phi$ is surjective... but that is what you are trying to prove, so you cannot assume it holds.
For abelian group, and more generally for modules, there is the dual concept to the kernel called the cokernel; given $f\colon M\to N$, the cokernel of $f$ is $\mathrm{coker}(f)=N/\mathrm{Im}(f)$. It is in fact the case that $f$ is surjective if and only if the cokernel is trivial, just like $f$ is injective if and only if the kernel is trivial. This does not work for arbitrary groups, though, because the image need not be normal. If you quotient out by the normal closure of the image you get the equivalent construction but it no longer "detects" surjectivity (because surjectivity is not a categorical notion).