Background: In a first course on multivariable calculus, it's really common to find examples of functions which are discontinuous, but continuous when restricted to any line, in order to build intuition for multivariable derivatives and limits. An example of such a function is the following:
$$\begin{cases} \frac{xy}{x^2+y^2} & x,y\neq 0 \\ 0 & x,y=0 \end{cases}$$
This function is continuous when restricted to any line, and by reparameterizing $y\mapsto y^k$, we find examples of functions which are discontinuous but continuous when restricted to higher-order algebraic curves.
Question: Is there an example of a function which is discontinuous but continuous when restricted to any algebraic curve (specifically, the vanishing locus of some polynomial)?
Inspiration: I recently tutored some students through some examples of the type mentioned above, and this popped up as a natural question to ask where I was unsure about what the answer was.
Work/thoughts: I've tried replacing $y$ with $e^y$ or $e^y-1$, but it appears that this doesn't even handle the case of lines.