Your doubts are well-founded. The solutions of the squared equation are merely possible solutions of the original equations.
Fortunately, you can check the answer by plugging it into the original equation.
First, recall that the $\pm$ sign means there are two proposed solutions.
Let’s consider the $+$ solution first:
$$
y = \frac{x}{\sqrt{1 - x^2}}. \tag1
$$
Note that this solution implies $-1<x<1.$
Now we try substituting the expression on the right of Equation $(1)$ for $y$ in the original equation. The result is
$$
x = \frac{ \left( \frac{x}{\sqrt{1 - x^2}} \right) }
{\sqrt{1+ \left( \frac{x}{\sqrt{1 - x^2}} \right)^2 }}
= \frac{ \left( \frac{x}{\sqrt{1 - x^2}} \right) }
{\sqrt{\frac{1}{1 - x^2} }} = x.
$$
That is, the substitution results in an equation that is always correct, $x=x.$
Now let’s consider the $-$ solution:
$$
y = - \frac{x}{\sqrt{1 - x^2}}. \tag2
$$
When we try substituting the expression on the right of Equation $(2)$ for $y$ in the original equation, the result is
$$
x = \frac{ \left( - \frac{x}{\sqrt{1 - x^2}} \right) }
{\sqrt{1+ \left( - \frac{x}{\sqrt{1 - x^2}} \right)^2 }}
= -\frac{ \left( \frac{x}{\sqrt{1 - x^2}} \right) }
{\sqrt{\frac{1}{1 - x^2} }} = -x.
$$
This is not correct unless $x=0.$
In fact, in the only case in which Equation $(2)$ can be true (the case $x=0,$ $y=0$), Equation $(1)$ is true.
The conclusion is that Equation $(1)$ (the $+$ case) is the complete solution, and the $\pm$ in the book’s solution is incorrect.
Another way to approach this question is to observe that
$\sqrt{1 + y^2}$
is always positive in the original equation, and therefore $x$ and $y$ always have the same sign.
In the proposed solution,
$\sqrt{1 - x^2}$
must also be positive.
The $+$ solution then ensures that $x$ and $y$ have the same sign, which is required.
But the $-$ part of the $\pm$ sign, insofar as it provides an alternative “solution,” says that $x$ and $y$ have opposite signs, which is impossible, except when $x=0,$ in which case the $\pm$ sign has no effect.
At this point you could still do the substitution to verify that the $+$ solution is correct, but there would be no need to check the $-$ alternative.