Photoevaporation of protoplanetary discs with PLUTO+PRIZMO: I. Lower X-ray–driven mass-loss rates due to enhanced cooling