The origin of the atomic and molecular gas contents of early-type galaxies - I. A new test of galaxy formation physics