In Calculus of Variations, Hamilton’s canonical equations (Calculus of Variations and Optimal Control Theory by Daniel Liberzon, p. 45) are
$$y'~=~H_p,\tag{1}$$ $$p'~=~-H_y.\tag{2}$$
I understand the second equation requires the Euler-Lagrange equation, but I think the first equation doesn't need the E-L equation. If so, any $y$ (optimal or not) can satisfy the first equation. Then, I wonder why we need the first equation?
Where Lagrange equations typically are 2nd order ODEs in the $y$-variables, the Hamilton's equations are twice as many 1st order ODEs in twice as many variables $(y,p)$.
So yes, we also need OP's eq. (1): It's the relation between velocity $y^{\prime}$ and momentum $p$. It is needed in order to turn OP's eq. (2) into Lagrange equation.
See also this related Phys.SE post.