An analogy with functions:
Say, we have a function $f(x)$ and we have an equation to solve, $f(x)=0$. We can always re-formulate the problem of solving $f(x)=0$ with the problem of extremising $F(x)$, where $F(x)$ is the anti-derivative of $f(x)$. This is purely mathematical.
In physics, we postulate that the path taken by a particle $x(t)$ is completely determined by the initial conditions $x(t_0)$ and $v(t_0)$. Mathematically, this can be expressed as:
$$\frac{d^2 x(t)}{dt^2}=F(x(t),v(t))$$
or equivalently,
$$\frac{d^2 x(t)}{dt^2}-F(x(t), v(t))=0$$
This is an equation which takes a path $x(t)$ as input and evaluates to 0. This is similar to $f(x)=0$ in the analogy at the top of the post.
So, is it a mathematical certainty that we are able to re-formulate this problem in terms of extremising a functional which takes the path $x(t)$ as input? If yes, it's not obvious to me how.