See, that tells me it was either the coolant temp sensor or the wiring to it. For most of us, when the coolant temp sensor fails the car gradually runs worse and worse as it warms up. In your case, it appears the sensor worked when cold but would then suddenly go open circuit when hot. I suppose you could test the old sensor in a pot of water on the stove to confirm if it’d make you feel better that you’ve really solved the problem.
When my CTS went bad, the problem was obvious: When I pulled the connector off, one of the terminals in the top of the sensor was loose and wiggling around in there.