Let $p=2$ be the even prime and without loss of generality assume $p<q<r$. Since $p,q,r$ are primes this means $r\geq 5$.
We shall first show the following:
Lemma. Let $2=p<q<r$ be primes and
$$
\begin{align}
2q-6 &= x^2\\
2r-6 &= y^2\\
qr-6 &= z^2
\end{align}
$$
for some integers $x,y,z\geq 0$. Then
$$
z+y = r
$$
Proof. Taking equations $2$ and $3$, we form the following:
$$
\begin{align}
z^2 &\equiv -6 \equiv y^2 \pmod r\\
(z+y)(z-y) &\equiv 0 \pmod r
\end{align}
$$
Therefore $r$ divides $z+y$ or $z-y$. We first assume the latter, then
$$
\begin{align}
z-y &\equiv 0 \pmod r\\
z &= y + kr
\end{align}
$$
for some $k\geq 0$ since $z> y$. But now
$$
\begin{align}
0 &< y+kr=z =\sqrt{qr-6} < \sqrt{r^2} = r\\
0 & < y+kr < r \implies k=0
\end{align}
$$
This means that
$$
z = y
$$
which is not possible. Hence we must have instead
$$
\begin{align}
z+y &\equiv 0 \pmod r\\
z+y &= kr\\
0 < kr &= z+y\\
&= \sqrt{qr-6}+\sqrt{2r-6}\\
&< \sqrt{r^2} + \sqrt{4r}\\
&= r+2\sqrt{r}\\
&< 2r\\
0<kr &< 2r
\end{align}
$$
where the last equality is because
$$
r\geq 5 \implies 4r < r^2 \implies 2\sqrt{r} < r
$$
Therefore we must have precisely $k=1$, giving $z+y=r$.
$$
\tag*{$\square$}
$$
We now show that
Proposition. Let $p=2$ and
$$
\begin{align}
2r-6 &= y^2\\
qr-6 &= z^2\\
z+y &= r
\end{align}
$$
for some integers $q,r,y,z\geq 0$. Then
$$
p+q+r-9 = (y-1)^2
$$
Proof. Using $z+y=r$, we have
$$
\begin{align}
r &= z+y\\
&= \sqrt{qr-6} + \sqrt{2r-6}\\
\sqrt{qr-6} &= r - \sqrt{2r-6}\\
qr-6 &= r^2-2r\sqrt{2r-6} + (2r-6)\\
qr &= r^2-2r\sqrt{2r-6} + 2r\\
q &= r -2\sqrt{2r-6} + 2\\
p+q+r-9 = q+r-7 &= (2r-5) -2\sqrt{2r-6}\\
&= (y^2+1) - 2y\\
&= (y-1)^2
\end{align}
$$
$$
\tag*{$\square$}
$$
Edit 1: Deriving a formula similar to Will Jagy's.
Proposition. Primes $q,r$ satisfies
$$
\begin{align}
q &= 2(6k\pm 1)^2+3 = 5 + 24u\\
r &= 2(6k\pm 2)^2+3 = 11 + 24v
\end{align}
$$
for some integers $u,v\geq 0$ (must be same sign). This in turn gives
$$
\begin{align}
x &= \sqrt{2q-6} = 2(6k \pm 1)\\
y &= \sqrt{2r-6} = 2(6k \pm 2)\\
z &= \sqrt{qr-6} = 72k^2\pm 36k+7\\
q+r-9 &= (3(4k\pm 1))^2
\end{align}
$$
Proof. We start from
$$
\begin{align}
2q-6&=x^2\implies -6\equiv x^2\pmod q\\
2r-6&=y^2\implies -6\equiv y^2\pmod r
\end{align}
$$
Since $-6$ is a square, by Quadratic Reciprocity we get $q,r\equiv 1,5,7,11\pmod{24}$.
Now the third equation gives
$$
qr-6 = z^2\implies qr=z^2+6
$$
Since $z^2+6\equiv 6,7,10,15,18,22\pmod{24}$, the only possible combinations of $(q,r)\pmod{24}$ are
$$
(1,7),(5,11),(7,1),(11,5)
$$
For $q\equiv 1,7 \pmod{24}$, we observe that
$$
2q-6 =x^2\implies 20,8\equiv x^2\pmod{24}
$$
which is not possible. Therefore up to interchanging $q$ and $r$, we may assume that
$$
(q,r)\equiv (5,11) \pmod{24}
$$
Hence we now have
$$
\begin{align}
q &= 2a^2+3 = 5+24u\\
r &= 2b^2+3 = 11+24v
\end{align}
$$
for some integers $a,b,u,v\geq 0$. By checking $\pmod{24}$, we can show that
$$
a = 6m\pm 1,\quad b = 6n\pm 2
$$
Further, using $q=r-2\sqrt{2r-6}+2$ as before:
$$
\begin{align}
q &= r-2\sqrt{2r-6}+2\\
72 m^2 \pm 24 m + 5 &= 72 n^2 \pm 24 n + 5\\
9 m^2 \pm 6 m + 1 &= 9 n^2 \pm 6 n + 1\\
(3m \pm 1)^2 &= (3n\pm 1)^2
\end{align}
$$
it must be the case that $m=n=k$ and $6m\pm 1,6n\pm 2$ has the same sign. Then a direct computation gives the formula for $z$ and $p+q+r-9$.
Best Answer
It's not true that if $m$ is a quadratic residue modulo infinitely many primes, then $m$ must be a square. For example, $2$ is a quadratic residue modulo every prime that is congruent to $\pm 1$ modulo $8$, but $2$ is not a square.
Fortunately, it is true that if $m$ is a quadratic residue modulo every sufficiently large prime, then $m$ is a square.
For any natural number $a$, and any prime $p$, we have that $$ af(a) \equiv af(a) + pf(p) + 2ap \pmod p $$ and so $af(a)$ is a square modulo every prime $p$. It follows that $af(a)$ is a square for every natural number $a$.
We will show that if $p$ is an odd prime then $f(p) = p$.
Suppose that $q \neq p$ is an odd prime such that $q \mid f(p)$.
Then $ qf(q) + pf(p) + 2pq $ is a square that is divisible by $q$, and hence by $q^2$. We note that $qf(q)$ is divisible by $q^2$, and so if $f(p)$ were divisible by $q^2$, then $2pq$ would be divisible by $q^2$, which is a contradiction.
Thus $f(p)$, and hence $pf(p)$, is divisible by $q$ only once, which is a contradiction since $pf(p)$ is a square.
Thus the only primes that divide $f(p)$ are $2$ (possibly), and $p$. Since $pf(p)$ is a square, we know that $p$ divides $f(p)$ an odd number of times.
Note that $$ 2pf(p) + 2p^2 $$ is a square. If $f(p)$ were even, then the left hand side would be $2$ modulo $4$, which would be a contradiction. Thus, in fact, $2$ does not divide $f(p)$. We thus have that $f(p) = p^{2t + 1}$ for some natural number $t$.
We now note that $$ p^{2t + 2} + 2p + 1 = pf(p) + 1f(1) + 2p $$ is a square. But $$ (p^{t + 1})^2 < p^{2t + 2} + 2p + 1 \leq p^{2t + 2} + 2p^{t + 1} + 1 = (p^{t + 1} + 1)^2 $$ and so we must have that $t = 0$ and $f(p) = p$.
We now have that for every natural number $a$, and every odd prime $p$, that $$ af(a) + 2ap + p^2 $$ is a square, and so is equal to $(p + m_p)^2$ for some $m_p$ which depends on $p$.
We easily see that $0 < m_p \leq af(a)$ for all $p$. (We could probably find a better upper bound, but the point is that it is bounded by something that does not depend on $p$.)
Thus there are infinitely many primes $p$ with the same value of $m_p$. Let this value be $m$.
Then there are infinitely many primes $p$ such that $$ af(a) + 2ap + p^2 = p^2 + 2mp + m^2 $$ or $$ af(a) + 2ap = m^2 + 2mp $$
Thus $af(a) - m^2$ is divisible by infinitely many primes $p$, and so $af(a) = m^2$. The equation then becomes $m^2 + 2ap = m^2 + 2mp$, and so $a = m$. Thus $af(a) = a^2$, and so $f(a) = a$ for all $a$.