I remember feeling that the proof was cutting corners when it suddenly just ignored one of the variables, so this is roughly what I came up with to reassure myself of the result.
To summarize, the Lagrangian approach finds a path $q(t)$ which minimizes the action $S[q]=\int_{t_0}^{t_1} L_t(q(t),\dot q(t))\,dt$ where $L(q,v)$ is the Lagrangian that describes the mechanics of the system and $\dot q=dq/dt$. A solution that minimizes $S[q]$ requires
$$
\frac{\partial L_t}{\partial q}(q(t),\dot t(t))
= \frac{d}{dt}\frac{\partial L_t}{\partial v}(q(t),\dot q(t)).
$$
The Hamiltonian is typically defined as $H_t(q,p)=p\cdot\dot q-L_t(q,\dot q)$ where $p=\partial L_t/\partial v$, and the solution that minimizes $S[q]$ must satisfy the Hamiltonian equations
$$
\dot q = \frac{\partial H}{\partial p}
\quad\text{and}\quad
\dot p = -\frac{\partial H}{\partial q}.
$$
But the definition of the Hamiltonian also contains $\dot q$, which is ignored.
Let's instead use $F_t(q,v,p)=p\cdot v-L_t(q,v)$. The curve which solves the Lagrangian equations has $v=\dot q$ and $p=\partial L_t/\partial v$. Along this curve, we get
$$
\frac{\partial F_t}{\partial v}(q,\dot q,p)
= p - \frac{\partial L_t}{\partial v}(q,\dot q) = 0,
$$
while the partial derivatives in $q$ and $p$ yield the Hamiltonian equations.
Alternatively, you could reformulate the same in terms of the surface parametrized by $(q,v)\mapsto(q,v,p)=(q,v,\partial L_t/\partial v)$ which you then project to $(q,p)$ for the Hamiltonian approach: the partial derivative $\partial F_t/\partial v=0$ on that surface.