Most jet planes are using external air to create cool compressed air that recycles inside the cabins. When on the ground the outside air is no different than the inside so nothing gets cooled. At 35k feet the outside air is like -50F so it provides mad AC. They can run something called an APU (aux power unit) that can provide some AC, but its actually not required that the APU even functions so it may have just been disabled. Some airports provide external APU to cool cabins at the gate but if the plane is out on the runway thats not an option.
A fucked up situation though and the passenger should have been allowed to deplane within 10 minutes of realizing the delay is gonna be longer than 30 mins and more importantly someone should have realized the baby is not well and recommended they fly another day, preferably at night. 4 month babies shouldn't be flying period, imo.
I thought some law got passed a while back that if a plane is sitting on the runway for more than 30 or 60 mins passengers have a right to deplane and even get compensation, that might be a european thing though.