Here I do not understand the sentence
Note that even if $L$ does not depend on $u$, the cost $J$ depends on the control $u(\cdot)$ through $x(\cdot)$ which is the trajectory that this control generates.
How can an input $u$ generate a trajectory when it is not present in $L$? It seems that $u$ generates $x$ just by the fact that it is not present somewhere else!
Q: How can an input u generate a trajectory when it is not present in L ?
A: Simply by being present in the differential equation that defines the trajectory (along with the initial conditions).
Example:
$$\dot{x} = u(t), \; x(0) = x_0$$
The solution to this is
$$x(u(t), t) = x_0 + \int_0^t u(\tau) \text{d}\tau$$
You could choose the Lagrangian to not explicitly depend on $u$
$$L = x^2,$$
but it would still do since $x$ does. So does the cost $J$.