Probing the QCD equation of state with thermal photons in nucleus–nucleus collisions at RHIC