I've been studying the Legendre transform and it's been a fun realization to see that the relationship between the Lagrangian and the Hamiltonian is simply a Legendre transform, i.e.,
$$\{H, p\}\rightarrow \{L,v\}.\tag{1}$$
I first saw it in this paper: https://aapt.scitation.org/doi/10.1119/1.3119512
This Legendre transform link between the Hamiltonian/Lagrangian is neat because it implies, $$v \equiv \frac{dH}{dp}.\tag{2}$$
Which we already know from intuition/formulation of the Hamiltonian. Anyways, what I'm wondering is why we necessarilly use the Lagrangian when calculating action. Or more specifically, when demonstrating the principle of least action, i.e.,
$$\text{minimize}\left(S=\int_{t_1}^{t_2}Ldt\right).\tag{3}$$
Following Feynman's derivation of this for classical mechanics was simplest for me, and I was able to follow it. But I guess my question is more so why the action function uses the Lagrangian and not the Hamiltonian. Now, the result of the above equation for classical mechanics provides,
$$\frac{dU}{dx}=-m\ddot{x}.\tag{4}$$
Which is self evident is showing why the Lagrangian works in the theory. But is there any reason why we wouldn't be prompted to calculate the following?
$$S=\int_{t_1}^{t_2}Hdt. \tag{5}$$
(Other than the fact that the Legendre transform tells us that it should probably be, $S=\int_{t_1}^{t_2}(p\frac{dH}{dp} - H)dt.$) In other words, is it the former simply because the physics is self-consistent? Or am I missing something?