As such, forcing the Dirac equation to be phase-invariant allows it to describe the electromagnetic interaction as a bonus.
By requiring the Dirac equation to be invariant under phase transformations, it is possible for this equation to describe electromagnetic interactions in addition to its primary function.