Sounds like your waterheater has
heating coils which go from the engine to the water heater, then cycle back to the engine
cooling system. I suspect you are getting an example of heat convection--heated water in the water heater is warming the water in the
heating coils, forcing it back towards the engine
cooling system.
When the engine is running and the water heater is not, the hot water from the engine goes through the coils to heat water in the water heater, then circulates back to the engine. When the engine is off, but the waterheater is on, the heating water in the tank transfers heat to the cool water in the coils, drawing it back to the engine.