HYBRID-CHIMES: a model for radiative cooling and the abundances of ions and molecules in simulations of galaxy formation