GR doesn't force anything. As I said you need to employ (heuristic) principles to write down the Lagrangian for a given physical situation.
A first guess for generalizing physical laws from special to general relativity is to substitute covariant derivatives, wherever you have a partial derivative in the special theory (using Galileian coordinates). That's however not unique, because covariant derivatives do not commute, while partial derivatives do. That's already a problem for naively translating Maxwell's equations (which are 2nd order equations when written in terms of the four-potential). The Lagrangian, however only involves first-order derivatives, and particularly simple only four-curls, i.e., you have
$$\mathcal{L}=-\frac{1}{4} F_{\mu \nu} F^{\mu \nu}, \quad \text{with} \quad F_{\mu \nu} = \nabla_{\mu} A_{\nu}-\nabla_{\nu} A_{\mu} = \partial_{\mu} A_{\nu} -\partial_{\nu} A_{\mu}, \quad F^{\mu \nu} = g^{\mu \rho} g^{\nu \sigma} F_{\rho \sigma}.$$
This you plug into the action
$$S=\int \mathrm{d}^4 q \sqrt{-g} \mathcal{L}$$
leading uniquely to the correct (free) Maxwell equations using Hamilton's principle for the variation of the vector field ##A_{\mu}##. The variation with respect to ##g_{\mu \nu}## gives you uniquely the correct symmetric (and gauge invariant!) energy-momentum tensor of the electromagnetic field, and this must (within General Relativity) provide the correct local energy and momentum density of the electromagnetic field, while within Special Relativity the energy-momentum tensor is not uniquely defined from Noether's theorem (applied to space-time translation invariance of the Minkowski space), but only total energy and momentum are uniquely defined.