This is not an answer, but gives some (more) evidences.

Let's say that an algebra $A$ satisfies property $(P)$ if for any element $a$ of $A$ there exists an element $x$ in $A^\times$ and elements $y,z$ in $A$ such that the following equality hold $$a=x(y^2+z^2) \ \ .$$

$\bullet$ Let $R$ be a principal ideal domain, and assume $2$ is invertible in $R$. Then $A:=\mathrm{M}_2(R)$ satisfies property $(P)$.

Indeed, we can always write
$$M=\left(\begin{array}{cc} \alpha &\beta\\ 0&\gamma\end{array}\right)=
\left(\begin{array}{cc} u &\beta\\ 0&1-u\end{array}\right)^2
+
\left(\begin{array}{cc} 0&1\\ \alpha-u^2&0\end{array}\right)^2$$
with
$u=\frac{\alpha-\gamma+1}{2}$.

$\bullet$ The algebra $\mathrm{M}_2(\mathbf Z)$ satisfies proprty $(P)$. Let $M$ be an upper triangular matrix as above.

a) The above equality shows that if $\alpha-\beta$ is odd, we have a solution.

b) If $M$ is an even matrix, $M=2M'$, then the result follows from the result for $M'$ and the remark $$(\star)\ \ \ (x-y)^2+(x+y)^2=2x^2+2y^2\ \ .$$

c) If $\alpha$ and $\gamma$ are even, but $\beta$ is odd, then by rows manipulations, we can obtain a lower triangular matrix from $M$, with the first second diagonal entry even and the second odd. Thus we are in the same situation as in a).

d) If $\alpha$ and $\gamma$ are odd then up to row manipulations we can assume $\beta$ is even, $\beta=2\beta'$, and we can also assume that $\alpha-\gamma$ is a multiple of $4$. We write

$$M=\left(\begin{array}{cc} \alpha &\beta\\ 0&\gamma\end{array}\right)=
\left(\begin{array}{cc} u &\beta'\\ 0&2-u\end{array}\right)^2
+
\left(\begin{array}{cc} 0&1\\ \alpha-u^2&0\end{array}\right)^2$$
with
$u=\frac{\alpha-\gamma+4}{4}$.

$\bullet$ Note that it's not true that any matrix in $\mathrm{M}_2(\mathbf Z)$ is a sum of two squares. A counter-example is $M=\left(\begin{array}{cc} 1 &0\\ 0&3\end{array}\right)$. But any matrix in $\mathrm{M}_2(\mathbf Z)$ is a sum of three squares. This can be found in Morris Newman, Sums of squares of matrices, PJM 118, 1985 (thanks to Will Jagy for the reference).

$\bullet$ Let $\mathbf H$ denote the ring of Hurewitz integers. The above remarks show that the property is true for $\mathbf H\otimes\mathbf Z_p$ for odd primes $p$ (edit : since there is an isomorphism of algebras $\mathbf H\otimes\mathbf Z_p\simeq \mathrm{M}_2(\mathbf Z_p)$). It would be interesting to know what happens for $\mathbf H\otimes\mathbf Z_2$.

Edit : computations indicate at least that $A :=\mathbf H\otimes\mathbf Z/32$ has property $(P)$, but that even more is true : any quaternion $q\in A$ can be written as the product of the image in $A$ of a unit of $\mathbf H$ and a sum of two squares. The problem, for now, is that the map $x\mapsto x^2$ is far from being smooth, and no Hensel lemma can be brutally invoqued.

$\bullet$ New Edit : So it seems $A:=\mathbf H\otimes\mathbf Z_2$ satisfies a strong form of property $(P)$ as explained above : any quaternion $q\in A$ can be written as the product of the image in $A$ of a unit of $\mathbf H$ and a sum of two squares.

Here is a proof :

$\to$ By $(\star)$, we note that it suffices to prove the result for quaternions whose class is non-trivial in $A\otimes\mathbf Z/2$.

$\to$ Let $f:A\to A$ be the map $x\mapsto x^2$. We compute $\mathrm{det}(d_x(f))=4\mathrm{Tr}(x)^2N(x)$. Let's say that a unit of $A$ is nice if its trace is a unit. For $x$ such a nice unit, the image of d_x(f)) contains $2.\mathbf H_2$. Thus a quaternion that has the same class in $A\otimes\mathbf Z/8$ than the square of a nice unit is the square of a nice unit.

$\to$ It hapens that all quaternions in $A\otimes\mathbf Z/8$ that are not trivial in $A\otimes\mathbf Z/2$ are the product of

- the image in $A\otimes\mathbf Z/8$ of a unit of $\mathbf H$

by

- the sum of two images in $A\otimes\mathbf Z/8$ of squares of nice units (direct computation).

$\to$ The result follows.

(Remark : $2$ is not a prime in $\mathbf H$. It is ramified. Thus these methods might well be refined by working mod $(1-i)^s$. In fact experiments show that the liftability of squares of nice units is already available from $A\otimes\mathbf Z/4$ on.)