Cosmic chemical evolution with an early population of intermediate-mass stars