We notice that the second equation can be factored as
\[xy(x+y) + (x+y) = 63,\]or
\[(x+y)(xy+1) = 63.\]Since $xy = 6,$ this becomes
\[(x+y)(6+1) = 63,\]or
\[(x+y)(7) = 63.\]Hence, $x+y = 9.$

We also have $xy = 6.$ Squaring the equation $x+y = 9,$ we get
\[x^2 + 2xy + y^2 = 81.\]Substituting $xy = 6,$ we get
\[x^2 + 2 \cdot 6 + y^2 = 81,\]or
\[x^2 + y^2 = 81 - 12 = \boxed{69}.\]The answer is: 69
Below is a math problem. Provide a detailed, step-by-step solution.

### Problem:
If $(x,y)$ is a solution to the system
\begin{align*}
xy &= 6, \\
x^2 y + xy^2 + x + y &= 63,
\end{align*}find $x^2 + y^2.$

### Answer:
