Solution by OronSH.
We claim the solutions are f(x)=0 and f(x)=x, which we can see work.
Denote the assertion by P(x,y). Note that P(−f(0),0) gives f(f(0)2)=0, and P(0,0) gives f(f(0)2)=2f(0), hence f(0)=0. Thus P(x,0) gives f(xf(x))=f(x2).
Suppose f(a)=f(b). Comparing P(a,y) and P(b,y) gives f(ay)=f(by) for any y. Hence, by taking a=xf(x),b=x2,y=x1 we get f(f(x))=f(x). In particular f(yf(x))=f(xy) for all x,y.
Note that f(f(x)2)=f(xf(x))=f(x2). Hence comparing P(x,y) with P(f(x),y) we get f(xf(x)+f(x)f(y))=f(f(x)2+f(x)f(y)). By scaling both insides by f(x)1, we get f(x+f(y))=f(f(x)+f(y)), which by symmetry equals f(f(x)+y). Scaling back up by f(x) inside gives that f(f(x)2+yf(x))=f(xf(x)+f(x)f(y))=f(x2)+f(xy). However from f(yf(x))=f(xy) we get f(f(x)2+yf(x))=f(xf(x)+xy).
Note that if f(x)=0 and x=0 then from f(yf(x))=f(xy) we get f is constantly zero, so assume f is injective at zero. In our previous equation, force xf(x)+xy=x2 when x=0, which implies f(xy)=0, hence xy=0 and thus y=x−f(x)=0, so f(x)=x as desired.