Your first error is that $\frac{y-x}{y^2-x} \ne y$, but similar (fake) proof could avoid this. The most important thing to note is that you divide $y^2-x$ or $y$ on both side. There is the problem.
When you have an equality $a=b$, you must $\textbf{always}$ check that $b\ne 0$ if you want to conclude that $\frac{a}{b}=1$. Indeed, $\textit{dividing b on both side}$ actually means $\textit{multiply by} \ \frac{1}{b}$ on both side, which is only possible if $b\ne0$.
Now, as said @dxiv, try to do your reasoning with $x=2, y=2$ to see where you cheated.