With $u=f(1)$, let
$$ S=\{\,n\in\Bbb N_0\mid f(n)=nu\,\}.$$
Clearly,
- $0\in S$,
- $1\in S$,
- If two of $a,b,a^2+b^2$ are $\in S$, then so is the third
- If one of $a,2a^2$ is $\in S$, then so is the other
- If $a^2+b^2=c^2+d^2$ and three of $a,b,c,d$ are $\in S$, then so is the fourth
From these, we conclude by induction (as you already did), $2^n\in S$ for all $n$, but we also have for example $5=2^2+1^2\in S$ and then from $3^2+4^2=0^2+5^2$, we get $3\in S$ and also $9=3^2\in S$.
We also have $7\in S$ from $7^2+1^2=2\cdot 5^2$.
Also, $10=3^2+1^2\in S$. Thus the last bullit point applied to $6,8,10,0$ gives us $6\in S$.
Assume $S\ne\Bbb N_0$ and let $a=\min(\Bbb N_0\setminus S)$. From the results so far, we know $a\ge 11$.
Lemma 1. Let $k$ be odd and assume $a\ge M$, where $$M\ge\frac{9k^2+4k}8.$$ Then $2a-k$ is prime.
Proof. Assume $2a-k=rs$ with $1<r\le s$. Then $r,s$ are odd and hence $r\ge 3$ and
$$s\ge \sqrt{2M-k}\ge\frac32k.$$
We have
$$a^2-(a-k)^2=kr\cdot s=\left(\frac{kr+s}2\right)^2- \left(\frac{|kr-s|}2\right)^2,$$
where $a-k$, $\frac{kr+s}2$, $\frac{|kr-s|}2$ are natural numbers. To see that they are all $<a$, note that
$$\frac{kr+s}2=\frac{2a-k}2\left(\frac ks+\frac 1r\right) \le
\frac{2a-k}2\left(\frac23+\frac13\right)<a. $$
Thus by minimality of $a$, we conclude $a-k, \frac{kr+s}2, \frac{|kr-s|}2\in S$, and then by the last bullit point above, we conclude $a\in S$, contradiction. $\square$
Corollary. $a\le 24$.
Proof. Otherwise, apply the lemma with $k=1,3,5$ and $M=25$ to find three consecutive primes $2a-5,2a-3,2a-1$ (and they are not $3,5,7$). $\square$
By the same method with $M=11$, we see that $2a-3, 2a-1$ are twin primes. Together with the special cases we have already found above, the only remaining possibility is $a=22$.
Using
$$ 22^2+4^2=20^2+10^2$$
we finally eliminate this case as well.
But if there is no possible value for $a=\min(\Bbb N_0\setminus S)$, it must be the case that $S=\Bbb N_0$.