I was reading this answer, where the issue of substituting equations of motion (eoms) into the action is addressed. I am fine with the basic idea that the action principle is destroyed when the eoms are substituted back, since the variation over all paths is not the same as before.
However, as @Qmechanic pointed out, there may be a measure-zero set of exceptions. More generally consider an action $$L \equiv L (\Pi_i, X_i, X_j), \quad i \in (1,N), \quad j \in (N+1, M),\tag{1}$$ such that $X_j$ appears non-linearly in the action. Since variables $X_j$ do not have a conjugate momenta, can we simply substitute them back into the action, even if they are non-linear, unlike linear Lagrange multipliers. What is the proof for the same?
More specifically consider the case of an action which does not have a canonical momentum, e.g. in equation 2.1, page 13 of this review, where they consider linearized massive gravity.
$$ S = \int d^D x \left(-\frac{1}{2} \partial_\lambda h_{\mu\nu}\partial^\lambda h^{\mu\nu} + \partial_\mu h_{\nu\lambda}\partial^\nu h^{\mu\lambda}-\partial_\mu h^{\mu\nu}\partial^\nu h +\frac{1}{2} \partial_\lambda h\partial^\lambda h -\frac{1}{2} m^2(h_{\mu\nu}h^{\mu\nu}-h^2)\right).\tag{2}$$
One can check that if $m=0$, then $h_{0i}$ are simply Lagrange multipliers. This gives rise to standard constraints which arise since $h_{0i}$ act as Lagrange multipliers. However if $m\neq 0$, then there is no Lagrange multiplier since the there exists a quadratic term in $h_{0i}$ as well.
What the authors do is in the case $m\neq 0$ to use the equation of motion to solve for $h_{0i}$ in eqn 2.7, and substitute it back into the action. Again, is it a valid operation here, and does its validity have any relation to the fact that the momentum $\Pi_{0i}$ conjugate to $h_{0i}$ vanishes?