Edit. As an example illustrating my point in a very simple example, let me solve the diophantine equation $x^2 + 5y^2 = z^2$ in several different ways. I will always assume that $\gcd(x,y) = 1$.
1. Elementary Number Theory
The basic idea is factoring: from $5y^2 = (z+x)(z-x)$. Since $d = \gcd(z-x,z+x) = \gcd(2z,z+x) \mid 2$ we have $d = 1$ or $d = 2$; moreover we clearly have $z-x > 0$.
This gives $z+x = da^2$, $z-x = 5db^2$ or $z+x = 5da^2$, $z-x = db^2$. Solving for $x$ and $z$ yields
$$ x = \pm \frac d2 (a^2 - 5b^2), \quad y = dab. $$
2. Parametrization
Set $X = \frac xz$ and $Y = \frac yz$; then $X^2 + 5Y^2 = 1$. Take the line $Y = t(X+1)$ through the obvious point $(-1,0)$; the second point of intersection is given by
$$ X = \frac{1-5t^2}{1+5t^2}, \quad Y = \frac{2t}{1+5t^2}. $$
Dehomogenizing using $t = \frac ba$ and $X = \frac xz$ etc. gives
the projective parametrization
$$ (x:y:z) = (a^2-5b^2:2ab:a^2+5b^2). $$
If $ab$ is odd, all coordinates are even, and we find
$$ x = \frac12(a^2 - 5b^2), \quad y = ab; $$
if $a$ or $b$ is even we get
$$ x = a^2 - 5b^2, \quad y = 2ab $$
as above.
3. Algebraic Number Theory
Consider the factorization
$$ (x + y\sqrt{-5}\,)(x - y\sqrt{-5}\,) = z^2 $$
in the ring of integers of the number field $K = {\mathbb Q}(\sqrt{-5}\,)$.
The class number of $K$ is $2$, and the ideal class is generated by
the prime ideal ${\mathfrak p} = (2,1+\sqrt{-5}\,)$.
The ideal $(x + y\sqrt{-5}, x - y\sqrt{-5}\,)$ is either $(1)$ or
${\mathfrak p}$; thus
$$ (x + y\sqrt{-5}\,) = {\mathfrak a}^2, \quad (x - y\sqrt{-5}\,) =
{\mathfrak b}^2 $$
in the first and
$$ (x + y\sqrt{-5}\,) = {\mathfrak p}{\mathfrak a}^2, \quad
(x - y\sqrt{-5}\,) = {\mathfrak p}{\mathfrak b}^2 $$
in the second case.
The second case is impossible since the left hand side as well as
${\mathfrak a}^2$ are principal, but ${\mathfrak p}$ is not. We
could have seen this immediately since $x$ and $y$ cannot both be odd.
In the first case, assume first that ${\mathfrak a} = (a + b\sqrt{-5}\,)$
is principal. Since the only units in ${\mathcal O}_K$ are $\pm 1$,
this gives $x + y \sqrt{-5} = \pm(a+b\sqrt{-5}\,)^2$ and hence
$$ x = \pm (a^2 - 5b^2), \quad y = \pm 2ab. $$
If ${\mathfrak a}$ is not principal, then
${\mathfrak p}{\mathfrak a} = (a+b\sqrt{-5}\,)$ is,
and from $({\mathfrak p}{\mathfrak a})^2 = 2(x+y\sqrt{-5}\,)$ we
similarly get
$$ x = \pm \frac12(a^2 - 5b^2), \quad y = \pm ab. $$
4. S-Integers
The ring $R = {\mathbb Z}[\sqrt{-5}\,]$ is not a UFD, but $S = R[\frac12]$ is;
in fact, $S$ is even norm-Euclidean for the usual norm in $S$
(the norm is the same as in $R$ except that powers of $2$ are dropped).
It is also easily seen that $S^\times = \langle -1, 2 \rangle$. From
(\ref{E5}) and the fact that the factors on the left hand side are
coprime we deduce that $x + y\sqrt{-5} = \varepsilon \alpha^2$ for some unit
$\varepsilon \in S^\times$ and some $\alpha \in S$. Subsuming squares into
$\alpha$ we may assume that $\varepsilon \in \{\pm 1, \pm 2\}$. Setting
$\alpha = \frac{a + b\sqrt{-5}}{2^t}$, where we may assume that $a$
and $b$ are not both even, we get
$$ x + y \sqrt{-5} = \varepsilon \frac{a^2 - 5b^2 + 2ab\sqrt{-5}}{2^{2t}}. $$
It is easily seen that we must have $t = 0$ and $\varepsilon = \pm 1$ or
$t = 1$ and $\varepsilon = \pm 2$; a simple calculation then yields the
same formulas as above.
5. Hilbert Class Fields
The Hilbert class field of $K$ is given by $L = K(i)$. It is not
too difficult to show that $L$ has class number $1$ (actually it is
norm-Euclidean), and that its unit group is generated by $i = \sqrt{-1}$
and $\omega = \frac{1+\sqrt{5}}2$ (we only need to know that these
units and their product are not squares). From (\ref{E5}) and the fact
that the factors on the left hand side are coprime in ${\mathcal O}_K$
we deduce that $x + y \sqrt{-5} = \varepsilon \alpha^2$. Subsuming
squares into $\alpha^2$ we may assume that
$\varepsilon \in \{ i, \omega, i\omega \}$. Applying the nontrivial
automorphism of $L/K$ to $x + y \sqrt{-5} = \varepsilon \alpha^2$ we find
$\varepsilon \alpha^2 = \varepsilon' {\alpha'}^2$. Since the ideal
${\mathfrak a} = (\alpha)$ is fixed and since $L/K$ is unramified,
the ideal ${\mathfrak a}$ must be an ideal in ${\mathcal O}_K$.
Thus either ${\mathfrak a} = (a+b\sqrt{-5}\,)$ is principal in $K$,
or ${\mathfrak p} {\mathfrak a} = (a+b\sqrt{-5}\,)$ is; in the second
case we observe
that ${\mathfrak p} = (1+i)$ becomes principal in ${\mathcal O}_L$.
Thus either
$$ x + y \sqrt{-5} = (a+b\sqrt{-5}\,)^2 \quad \text{or} \quad
x + y \sqrt{-5} = i \Big(\frac{a+b\sqrt{-5}}{1+i}\,\Big)^2, $$
giving us the same formulas as above.
Avoiding ideal arithmetic in $K$ and only using the fact that
${\mathcal O}_L$ is a UFD seems to complicate the proof even more.