Cosmological bounds on sub-GeV dark vector bosons from electromagnetic energy injection