Example 9 Solve the equation
$$
x=\left(x^{2}+3 x-2\right)^{2}+3\left(x^{2}+3 x-2\right)-2
$$
(1996, Sichuan Province Junior High School: Mathematics Competition)
Let $y=x^{2}+3 x-2$, then the original equation can be transformed into the system of equations
$$
\left\{\begin{array}{l}
x=y^{2}+3 y-2, \\
y=x^{2}+3 x-2 .
\end{array}\right.
$$
(1) - (2), factorizing, we get
$$
\begin{array}{l}
(x-y)(x+y+4)=0 . \\
\therefore x-y=0 \text { or } x+y+4=0 .
\end{array}
$$

From $x-y=0$ we get $y=x$. Substituting into (1), we get
$$
\begin{array}{l}
x^{2}+2 x-2=0 . \\
\therefore x_{1}=-1+\sqrt{3}, x_{2}=-1-\sqrt{3} .
\end{array}
$$

From $x+y+4=0$ we get $y=-x-4$. Substituting into (1), we get
$$
\begin{array}{l}
x^{2}-4 x-2=0 . \\
\therefore x_{3}=-2+\sqrt{2}, x_{4}=-2-\sqrt{2} .
\end{array}
$$