The first observation follows from the law of quadratic reciprocity. Indeed, assume that $p\equiv 1\pmod{8}$ and $p=A^2+B^2$. Let $A'$ denote the odd part of $A$. Then $p\equiv B^2\pmod{A'}$, and hence $\left(\frac{p}{A'}\right)=1$. It follows that $\left(\frac{A'}{p}\right)=1$, and then by $\left(\frac{2}{p}\right)=1$ also $\left(\frac{A}{p}\right)=1$. In the same way, $\left(\frac{B}{p}\right)=1$. The second observation lies deeper. I will use Gerry Meyerson's helpful comment below the original post. For any prime $p=4n+1$, Gauss (1825) observed that $p=A^2+B^2$, where $A$ and $B$ are the absolute least residues modulo $p$ of $(2n)!/(2n!^2)$ and $(2n)!^2/(2n!^2)$. For a proof, see [Jacobsthal (1907)][1] or [Barnes (1974)][2]. Hence it suffices to show that in case when $4$ divides $n$, these two integers are fourth powers modulo $p$. So let us assume that $4\mid n$. By Wilson's theorem, $$(2n)!^{(p-1)/4}=(2n)!^{n}\equiv(p-1)!^{n/2}\equiv(-1)^{n/2}=1\pmod{p}.$$ Therefore, $(2n)!$ is a fourth power modulo $p$, and we only need to prove that $2n!^2$ is a fourth power modulo $p$. This is equivalent to $$2^{(p-1)/4}n!^{(p-1)/2}\equiv 1\pmod{p}.\tag{1}$$ However, this follows from Theorem 5 in Emma Lehmer's 1977 paper "Generalizations of Gauss's lemma", and we are done. For completeness, I spell out the proof of $(1)$. We observe that $n!^{(p-1)/2}\equiv(-1)^\nu\pmod{p}$, where $\nu$ is the number of quadratic non-residues in $[1,n]$. Hence $(1)$ is equivalent to $$2^n(-1)^\nu\equiv 1\pmod{p}.\tag{2}$$ To see this, let $a_1,\dotsc,a_\nu$ be the quadratic non-residues in $[1,n]$, and let $a_{\nu+1},\dotsc,a_n$ be the quadratic non-residues in $[n+1,2n]$. Then $2a_1,\dotsc,2a_\nu$ are the even quadratic non-residues in $[2,2n]$, and $p-2a_{\nu+1},\dotsc,p-2a_n$ are the odd quadratic non-residues in $[1,2n-1]$. It follows that $$\prod_{i=1}^\nu(2a_i)\prod_{i=\nu+1}^n(p-2a_i)=\prod_{i=1}^n a_i.$$ Taking residues modulo $p$ on both sides, we obtain after simplification that $$2^\nu(-2)^{n-\nu}\equiv 1\pmod{p}.$$ This is equivalent to $(2)$, because $n$ is even. [1]: https://gdz.sub.uni-goettingen.de/download/pdf/PPN243919689_0132/LOG_0017.pdf [2]: https://www.e-periodica.ch/cntmng?pid=ens-001%3A1974%3A20%3A%3A9