If on a well the 30-50 PSI changes will back up the hot water when the pressure drops. I found my water softener was getting hot from this as it's just upstream of the heater. So I put in a small bladder tank on the cold water inlet of the water heater. But then it was getting hot so I had to insulate it.Looking for water issues. Check all your faucets when you turn on just the cold water.
My parents had issues with the mixing valve on their shower (the one knob version) and kitchen faucet (1 lever). O-rings went and even when "off" the hot was mixing with cold causing an issue like that. They would also get "warm" water from bathroom faucet when only the cold handle was turned on.
Way back when I put a check valve on the cold water in. This had unintended consequences but proves the value of the high pressure overflow valve.