Constant function composition
The idea will be to use the Implicit function theorem (IFT).
If $Dg = 0$ identically, then we have that $g$ is constant and one may take $f(t) := (t, t)$, for example. Let us assume that $Dg$ is not identically zero.
Let $(a, b) \in \Bbb R^2$ be such that $Dg(a, b) \neq 0$.
We may assume WLOG that $g(a, b) = 0$.
(Else consider $\tilde g(x, y) = g(x, y) - g(a,b)$.)
WLOG we may also assume that $g_y(a, b) \neq 0$.
(If not, then we would have $g_x(a, b) \neq 0$ and it would proceed similarly.)
Now, by IFT, there exists an open interval $I$ containing $a$ and a continuously differentiable function $\tilde f: I\to \Bbb R$ such that $f(a) = b$ and $$g(x, \tilde f(x)) = 0$$ for all $x \in I$.
Define $f:I \to \Bbb R^2$ as $$f(t) = (t, \tilde f(t)).$$
Clearly, $f$ is injective. (Look at the first coordinate.)
Moreover, it is $C^1$ because $\tilde f$ is. (And so is $t\mapsto t$.)
Lastly, we have that $g\circ f = 0$, a constant, as desired.
Now, $I$ is not necessarily $(-1, 1)$ but that is easily fixable by considering a smooth bijection $\gamma: (-1, 1) \to I$ which would preserve all the above properties after composition with $f$.
One way to do is the following.
Suppose $Dg_p$ does not vanish at a point $p$. Then $Dg_p$ does not vanish in a neighborhood $U$ of $p$. Now the function $G|_U$ has $g(p)$ as a regular value, and thus $G^{-1}(p)$ is a $1$-dimensional embedded submanifold of $U$. Choose an injective curve in this manifold. Any such curve is the required $f$.
If $Dg_p$ vanishes for all $p$ then $g$ is constant and any injective curve in $\mathbb R^2$ does the job.
Another proof can be given along the following lines.
The derivative of $g$ at any point can be thought of as a member of $\mathbb R^2$. Thus we get a vector field $V:\mathbb R^2\to \mathbb R^2$. If $V$ is $0$ everywhere then $g$ is constant. So assume that $V(p)\neq 0$ at some $p$. We can define another vector field $V'$ which is defined by declaring $V'(q)$ as the "anticlockwise rotation of $V(q)$ by 90 degrees." The point is that "$g$ does not change along $V'$" since $Dg_{q}(V'(q))=0$ for all $q$. Now since $V'(p)\neq 0$, we can find $t>0$ and an integral curve $\gamma$ to $V'$ starting at the point $p$ such that this integral curve is defined in $(-t, t)$. Note that $g\circ \gamma$ is constant. One can notmalize the domain $(-t, t)$ to $(-1, 1)$ and obtain the function $f$ via $\gamma$.