I know that there are a lot of questions similar to this, but the reason I'm confused is that it seems that you can prove this just knowing that $a^2 + b^2 = p$ and not use the fact that $p \equiv 1$ (mod $4$) by the following:
Suppose $a + bi = xy$ ($x, y\in\mathbb{Z}[i]$). Then $N(x)N(y) = N(a + bi) = p$. This implies that $N(x) = 1$ or $N(y) = 1$ which tells us that $a + bi$ is irreducible and therefore a prime in the ring of Gaussian integers. Do I need to use the fact that $p$ is congruent to $1$? Help would be appreciated!