The better world these ghosts are singing of is not an earthly one, but a heavenly one.
The hero of the story is Jean Valjean, who only goes to the barricade to make sure Marius survives and ensures his adopted daughter's potential future happiness.