Exoplanet surveys around M dwarfs have detected a growing number of exoplanets with Earth-like insolation. It is expected that some of those planets are rocky planets with the potential for temperate climates favourable to surface liquid water. However, various models predict that terrestrial planets orbiting in the classical habitable zone around M dwarfs have no water or too much water, suggesting that habitable planets around M dwarfs might be rare. Here we present the results of an updated planetary population synthesis model, which includes the effects of water enrichment in the primordial atmosphere, caused by the oxidation of atmospheric hydrogen by rocky materials from incoming planetesimals and from the magma ocean. We find that this water production in the primordial atmosphere is found to significantly impact the occurrence of terrestrial rocky aqua planets, yielding ones with diverse water content. We estimate that 5-10% of the planets with a size $<1.3 R_\oplus$ orbiting early-to-mid M dwarfs have appropriate amounts of seawater for habitability. Such an occurrence rate would be high enough to detect potentially habitable planets by ongoing and near-future M-dwarf planet survey missions.