The cosmic evolution of dust-corrected metallicity in the neutral gas