If I understand your question correctly, you are asking for quite a pedestrian view of the Legendre transformation, which is much more of an elegant way to transform a system of ODEs into first-order ODEs than can be visible in this way. I would recommend you have a look at V. Arnold's Mathematical methods of Classical Mechanics for a look at how the Legendre transform really works and why we use it.

You are slightly misunderstanding the transformation to the momentum variable, which is defined to be
$$p=\frac{\partial f}{\partial y'}\tag{1}$$
and _not_ directly proportional to $y'$. The two are proportional only in the limited circumstance that $f=\frac 12 m(y')^2-V(y)$, and the relationship is in general more complicated. The only thing you need is for (1) to be a proper coordinate transformation, which means asking for the hessian $$\frac{\partial^2 f}{\partial y'\partial y'}$$ to be nonsingular and positive-definite; it's clear from that that the functional dependence of $p$ on $y'$ and $y$ can be very general indeed.

Given this, if you just want to see how this cleans up the notation, you're much better off _not_ dismembering the original Euler-Lagrange equation,
$$\frac d{dx}\frac{\partial f}{\partial y'}-\frac{\partial f}{\partial y}=0\tag{2},$$
which turns into Hamilton's equations
$$
\left\{\begin{array}
& \frac{\partial f}{\partial y'}=p,\\
\frac{d p}{dx}=\frac{\partial f}{\partial y},
\end{array}\right.
$$
simply by substituting in the correct definition (1) and either inverting the first equation to get $\frac{dy}{dx}$ in terms of $p$ and $y$, or simply realizing that it is part of a system of two ODEs of first order in $y$ and $p$.