There is the physics SE feature of offering (in the column on the right hand side of the page) suggestions, under the heading 'Related'
In this particular case the column 'Related' offers a link to a 2011 question titled Invariance of Lagrange on addition of total time derivative of a function of coordinates and time
According to the answer to that question that invariance is in accordance with relativity of inertial motion.
Example:
The dynamics of juggling balls is independent of some constant relative velocity. You can be on the platform of a train station, or in a train moving at a constant velocity, the way the balls will move relative to you is the same. If you throw the ball straight up it will land back in your hand. This holds good for the members of the equivalence class of inertial coordinate systems.
The criterion of stationary action is that in order to find the true trajectory you find the point in variation space where the derivative of the Action $S$ (with respect to variation) is zero.
That is, in terms of stationary action the value of the Action $S$ is in itself not relevant. The relevant factor is the derivative of the Action $S$ with respect to variation.
As we know, taking a derivative is an operation that discards some information. That leaves room to reverse engineer ways in which one can modify the Lagrangian while still ending up at the same point in variation space.
For more on the concept of stationary action:
There is a 2021 answer by me about Hamilton's stationary action with a two stage derivation:
1 Derivation of the Work-Energy theorem from $F=ma$
2 Demonstration that in cases where the Work-Energy theorem holds good Hamilton's stationary action will hold good also
(Of course, the usual presentation starts with positing Hamilton's stationary action and next it is demonstrated that F=ma can be recovered from that. As pointed out by contributor Kevin Zhou (jan 16, 2020): "[...] in physics you can often run derivations in both directions.")