Let $\phi:R\to S$ Be a surjective ring homomorphism and $M \subset S$ is maximal, then $\phi^{-1}(M)$ is maximal in $R$.
Here is what I wrote (it is known the preimage is an ideal, so prove only maximality)
Assume $\phi^{-1}(M) \subset W \subset R$. Then first $\phi(\phi^{-1}M) = S$ because $\phi$ is surjective. Hence $\phi(\phi^{-1}M) \subset \phi(W) \subset \phi(R) \implies S \subset \phi(W) \subset S \implies \phi(W) = S$.
Now let $w \in W$ and $\phi(w) \in \phi(W) = S = \phi(\phi^{-1}M)$, so $w \in \phi^{-1}M$? Or this only shows $x \in \phi^{-1}(M)$ such that $\phi(x) = \phi(w)$?
Is there a way to complete the proof with what I wrote?
(I already have witness the solution, basically $\phi^{-1}M \subset R$ is an ideal. Then by isomorphism theorems $S/M \approx R/\ker(\pi \circ \phi)$ where $\pi$ is the quotient map and usually field argument implies $\ker (\pi \circ \phi) = \phi^{-1}M$ because fields contain only two ideals)
The issue with your proof was discussed in the comments. We have $\phi(\phi^{-1}(M))=M\neq S$.
For the proof you mention, let $f:S\to S/M$ be the canonical surjective map onto the field $S/M$. Then $f\circ\phi$ has kernel exactly $\phi^{-1}(M)$, hence $S/M\cong R/\phi^{-1}(M)$. Since this is a field, it follows that $\phi^{-1}(M)$ is a maximal ideal.