If $x, y, z \in \mathbb{R}$ are solutions to the system of equations:
\[
\begin{cases}
  x - y + z - 1 = 0 \\
  xy + 2z^2 - 6z + 1 = 0
\end{cases}
\]
What is the greatest value of $(x - 1)^2 + (y + 1)^2$?

Let's think step by step and output the final answer within \boxed{}.
user