Consider a $C^1$ curve $\gamma:I\to\mathbb{R}^2$, where $I\subset \mathbb{R}$ denotes an open interval. What conditions on $\gamma$ are necessary and sufficient in order to guarantee that there is no $C^1$ function $f:U \to \mathbb{R}$, with $U\subset \mathbb{R}^2$ an open set and such that $f(\gamma(t))=0$, for every $t\in I$?
Edit: Here I also ask that $f$ is non constant on any open subset of $U$ (otherwise, as well pointed by @Moishe Kohan, we could simply take $f$ to be identically zero). Since I'm asking $f$ to be $C^1$, we can express this by saying that the gradient $\nabla f$ is nonzero, up to an empty interior subset of $U$.
Does $\gamma$ need to self intersect? Self accumulate? Does it need to have a fractal behavior?
This is possibly a duplicate to this question. However, I'm interested in the case that $I$ is an open (not closed) interval. Therefore, I believe the Whitney theorem mentioned in the comments to that question doesn't apply (please, tell me if I'm wrong).
Also, the question has only comments, but no answers. One of them by the way gives a very good suggestion, to take $f$ as the square distance to the curve. However, I'm really interested in the smoothness (at least $C^1$) of $f$.