The proof is correct. Below is the same proof using gcd laws (distributive, etc), for any integer $\,p$.
$\ \ \ \phantom{\frac{.}{\dfrac{.}.}} 1 = \smash[b]{\underbrace{\color{#0a0}{(p,a)}}_{\large =\, 1}\underbrace{(p,b)}_{\large =\, 1} = (\color{#0a0}{(p,a)}p,\color{#0a0}{(p,a)}b) = (p^2,ap,bp,ab) = ((\underbrace{p,a,b}_{\color{#c00}{\large =\,1}})\, p,ab) = (p,ab)} $
where above we have used the inference: $\ (p,a)=1\,\Rightarrow\,(p,a,b)\color{#c00}{ = 1},\,$ and basic gcd arithmetic.
Remark $ $ The following comparison (from here) might prove instructive ($p$ is any integer below)
Euclid's Lemma in Bezout form, gcd form and ideal form
$\quad \smash[t]{\begin{align}\\ \\
px\!+\!ay=&\,\color{#c00}1,\,\ p\ \mid\ ab\ \ \ \Rightarrow\, p\ \mid\ b.\ \ \ {\bf Proof}\!:\,\ p\ \mid\ pb,ab\, \Rightarrow\, p\,\mid pbx\!\!+\!aby = \!(\overbrace{px\!+\!ay}^{\large\color{#c00} 1}\!) b = b\\[.2em]
(p,\ \ \ a)=&\,\color{#c00}1,\,\ p\ \mid\ ab\ \ \ \Rightarrow\, p\ \mid\ b.\ \ \ {\bf Proof}\!:\,\ p\ \mid\ pb,ab\, \Rightarrow\, p\,\mid (pb,\ \ ab) = (p,\,\ \ \ a) \ b =\, b\\[.2em]
P\! +\!A\ =&\,\color{#c00}1,\, P\supseteq AB\, \Rightarrow P \supseteq B.\ {\bf Proof}\!:\! P \supseteq\! PB,\!AB\!\Rightarrow\!\! P\supseteq\! PB\!+\!\!AB =(P\!+\!A)B = B
\end{align}}$
Note how the Distributive Law for integers is replaced by the Distributive Law for gcds and ideals in the $2$nd last equality in the proofs.
Generally $\,\ c\mid ab\iff c/(c,a)\mid b\,$ by here, or even more generally for both gcds and ideals we have $\,(c,ab) = (c,(a,c)b).\,$ OP is special case $\,(c,as)=1\,$ (for $\,c\,$ prime).