Whether your current $j^\mu$ is conserved off-shell depends on your definition of $j^\mu$. If you define it via the Dirac and other charged fields, it will only be conserved assuming the equations of motion.

However, if you define $j^\mu$ via
$$ j^\mu = \partial^\nu F_{\mu\nu}, $$
i.e. as a function of the electromagnetic field and its derivatives, then $\partial_\mu j^\mu=0$ holds tautologically because it is
$$\partial_\mu j^\mu= \partial_\mu\partial_\nu F^{\mu\nu} =0$$
which vanishes because the $\mu\nu$-symmetric second derivatives are applied to a $\mu\nu$-antisymmetric field strength tensor. The possibility to make the local conservation law tautological is indeed linked to the existence of a gauge symmetry. Why? Because it's the equation of motion one may derive from variations of the fields that are equivalent to gauge transformations: the vanishing of the variation of the action under such variations is guaranteed even without the equations of motion, by the gauge symmetry, so the corresponding combination of the currents, $\partial_\mu j^\mu$, has to vanish identically.

This logic also guarantees that the Dirac and other charged field coupled to electromagnetism will have equations of motion that guarantee the local charge conservation.

An analogous statement exists in the case of the diffeomorphism symmetry:
$$\nabla_\mu G^{\mu\nu} = 0$$
also holds tautologically for the Einstein tensor $G$ defined in terms of the metric tensor and its derivatives.

This post has been migrated from (A51.SE)