Suppose that $f,g : \mathbb{R}^n \to \mathbb{R}$ are $C^1$ functions and $c$ is a regular value of $g$.
If $a \in g^{-1}(c)$ is a minimum for $f$ restricted to $g^{-1}(c)$ then there is $\lambda \in \mathbb{R}$ such that $$\nabla f(a) = \lambda \nabla g(a).$$
My attempt is as follows:
It is known that $$\nabla g(x) \perp g^{-1}(c) ~\text{forall}~ x\in g^{-1}(c).$$
Once $f$ restricted to $g^{-1}(c)$ has $a$ as a minimum point, then choose $\gamma(t) \subset g^{-1}(c)$ such that $\gamma(0) = a$ then
$$\frac{d}{dt}f(\gamma(0)) = 0.$$
Using the chain rule:
$$\nabla f(a)\cdot \gamma'(0) = 0.$$
Once $\gamma(t) \subset g^{-1}(c)$ it follows that:
$$\nabla g(a)\cdot \gamma'(0) = 0.$$
Once $\nabla g(a) \neq 0$ since $c$ is a regular value,
$$\nabla f(a) = 0 \Rightarrow \lambda = 0.$$
Otherwise, $\nabla f(a)$ is parallel to $\nabla g(a).$
Your proof seems to be incorrect. It doesn't make sense the argument you have used with the inner product.
Let $M = g^{-1} (c)$.
You must show a few things first.
1) $T_aM = [\nabla f(p)]^{\perp}$ where $p \in M$.
2) Notice that if $a \in M$ is a critical point in $M$ then for every differentiable path $\lambda : (-\delta, \delta) \to M$ with $\lambda (0) = a$ we have $(f \circ \lambda)'(0)= 0 $. Let $v = \lambda' (0)$, then this means that $\langle \nabla f(a) , v\rangle = 0$ . As $v$ is any vector in the tangent space $T_aM$, we see that $a \in M$ is a critical point of $f|_M$ iff $\nabla f(a)$ is orthogonal to the tangent space $T_aM$.
Now we have that $\nabla g(a) $ is a nonzero vector orthogonal to the tangent space $T_aM$. As the complement of $T_aM$ in $\mathbb R^{n}$ has dimension $1$, it follows that $\nabla f(a) \perp T_aM$ iff $\nabla f(a)$ is a multiple of $\nabla g(a)$.