Solution by jasperE3.
Claim: if f(g(x)+f(xy))=x2+f(xy) then g(x)−x2 is constant for x=0 and f(x)−x is eventually constant.
Proof. Let c=1−g(1).
P(x,0)⇒f(g(x)+f(0))=x2+f(0)⇒[f(0),∞)⊆f(R).
P(1,x)⇒f(g(1)+f(x))=1+f(x)⇒f(x+g(1))=x+1 for all x≥f(0), so f(x)=x+c for all x≥f(0)+g(1) (proving that f(x)−x is eventually linear).
P(x,xy)⇒f(g(x)+f(y))=x2+f(y) for all x=0.
For any x=0, take y≥max{f(0)+g(1),−g(x)+f(0)+g(1)} and this equation turns into:
g(x)+y+2c=g(x)+f(y)+c=f(g(x)+f(y))=x2+f(y)=x2+y+c,
so g(x)=x2−c for all x=0.
f(xf(x)+f(xy))=x2+f(xy).
By the claim, xf(x)−x2 is constant for x=0, and f(x)−x is eventually constant. If we say f(x)−x=a for all x>C>0 then xa is constant for x>C, the only way this is possible is if a=0. Therefore the constant that xf(x)−x2 is must be 0, so f(x)=x for all x=0.
P(−1,1)⇒f(0)=0, so f(x)=x for all x whether x=0 or x=0.