An analysis of the evolving comoving number density of galaxies in hydrodynamical simulations