There is this question in which the real roots of the quadratic equation have to be found:
$x^2 + x + 1 = 0$
To approach this problem, one can see that $x \neq 0$ because:
$(0)^2 + (0) + 1 = 0$
$1 \neq 0$
Therefore, it is legal to divide each term by $x$:
$x + 1 + \frac{1}{x} = 0$
$x = -1 - \frac{1}{x}$
Now, substitute $x$ into the original equation and solve:
$x^2 + (-1-\frac{1}{x}) + 1 = 0$
$x^2-\frac{1}{x} = 0$
$x^3 = 1$
$x = 1$
to get $x = 1$. Clearly this isn't the right answer. But why? Thanks.
For a different angle, substituting a variable from the same equation is valid, but not reversible. Doing such a substitution can introduce extraneous solutions that do not necessarily satisfy the original equation.
A trivial example of such a case is the equation $\,x=1\,$. We can substitute $\,1 \mapsto x\,$ on the RHS and end up with $\,x=x\,$. Of course that $\,x=1 \implies x=x\,$, but the converse is not true.
In OP's case, the original equation is quadratic in $\,x\,$ which has $2$ roots in $\Bbb C\,$, while the derived equation is a cubic which has $3$ roots in $\Bbb C\,$. It is quite clear that the two solution sets cannot be identical, and in fact the cubic has the extraneous root $\,x=1\,$ as noted already, which does not satisfy the original quadratic.