OP is asking about Ref. 1. This touches upon several topics:
Second-order Lagrangian formulations and their corresponding Ostrogradsky Hamiltonian formulation. This is discussed in e.g. thisthis Phys.SE post, where it is explained how to reduce to first-order formulation in the non-singular case.
Singular Legendre transformations, and constraints. See e.g. Ref. 2 & 3.
Caratheodory’s method of equivalent Lagrangians, and its connection to Hamilton-Jacobi theory. This is explained in Ref. 4 in the first-order case.
Now let us return to OP's title question. Let us stress that the Hamilton's principal function $S$ and the off-shell action functional $S[q]$ are different objects. (For first-order Lagrangians, this is e.g. explained in my Phys.SE answers herehere & herehere.) In particular, eq. (14) is part of Caratheodory’s method of equivalent Lagrangians. The $S$ appearing in eq. (14) is Hamilton's principal function, not the off-shell action functional. It depends on velocities because the theory is of second order.
References:
B.M. Pimentel & R.G. Teixeira, Hamilton-Jacobi formulation for singular systems with second order Lagrangians, arXiv:hep-th/9512099.
P.A.M. Dirac, Lectures on QM, (1964).
M. Henneaux and C. Teitelboim, Quantization of Gauge Systems, 1994.
H.A. Kastrup, Canonical theories of Lagrangian dynamical systems in physics, Phys. Rep. 101 (1983) 1; Section 2.4.