I try to provide a direct proof here using the above-mentioned theorem of Blackwell and Kuratowski's extension theorem.
In the following consider the subspace $W:=g(X) \subseteq Y$ endowed with the subspace-$\sigma$-algebra:
$$\Sigma_W := \{ B \cap W \mid B \in \Sigma_Y \}.$$
Kuratowski's extension theorem states that every measurable map $ h:W \to Z$ to a standard measurable space $Z$ can be extended to a measurable map $\tilde h:Y \to Z$.
This means that we only need to consider the surjective measurable map $g: X \to W$ and a map $h: W \to Z$ with $h \circ g = f$. We are thus left to show that such an $h$ is measurable.
Since $Y$ is a standard measurable space, $\Sigma_Y$ is countably generated and separated, which implies the same for $\Sigma_W$. So there exists a countable algebra $F$ that separates the points of $W$ such that $\Sigma_W = \sigma(F)$. In particular, the atoms of $\Sigma_W$ are the singletons $\{w\}$ for $w \in W$.
Now consider the two sub-$\sigma$-algebras of $\Sigma_X$:
$$ \Sigma_1 := \sigma(\{ g^{-1}(B) \mid B \in F \}), \qquad
\Sigma_2 := \{ g^{-1}(B) \mid B \subseteq W, g^{-1}(B) \in \Sigma_X \}. $$
Since $g$ is measurable, it is clear that we have the inclusion:
$$\Sigma_1 \subseteq \Sigma_2 \subseteq \Sigma_X.$$
Furthermore, $\Sigma_1$ is countably generated and its atoms are of the form $g^{-1}(w)$ for $w \in W$.
Now Blackwell's theorem also implies the reverse inclusion $\Sigma_2 \subseteq \Sigma_1$. Indeed, if $A = g^{-1}(B) \in \Sigma_2$ with $g^{-1}(B) \in \Sigma_X$ and $B \subseteq W$, then $A = \bigcup_{w \in B} g^{-1}(w)$ and thus $A \in \Sigma_1$ by Blackwell's theorem.
We thus get the equality:
$$\Sigma_1 = \Sigma_2.$$
We now focus on the push-forward $\sigma$-algebras:
$$ g_*\Sigma := \{ B \subseteq W \mid g^{-1}(B) \in \Sigma \}.$$
By the surjectivity of $g$ we always have $g(g^{-1}(B))=B$ for every $B \subseteq W$. We thus get the chain of equalities:
$$ g_*\Sigma_X = g_*\Sigma_2 = g_*\Sigma_1 = \sigma(F)=\Sigma_W. $$
Now let $C \in \Sigma_Z$. By the measurability of $f$ we get:
$$\Sigma_X \ni f^{-1}(C) = g^{-1}(h^{-1}(C)).$$
This shows that:
$$h^{-1}(C) \in g_*\Sigma_X = \Sigma_W,$$
which shows that $h$ is measurable. This concludes the proof.
Edit: A short argument to see Kuratowski's extension theorem is to consider $Z=[0,\infty]$, which one wlog can always assume if $Z$ is a standard measurable space. Then the map $h:W \to Z$ is the limit of simple functions of the form:
$$ \sum_n c_n \cdot 1\!\!1_{B_n \cap W}.$$
Then an extension $\tilde h: Y \to Z$ is just given by taking the same limit of simple functions of the form:
$$ \sum_n c_n \cdot 1\!\!1_{B_n}.$$