How does cold water pressure get used by a hot water heater to produce hot water pressure?
The "overflow pipe" in the diagram is not an overflow pipe. 

The water heater is fitted with a relief valve which remains closed against the usual water pressure in your plumbing, but which will pop open if either the pressure or the temperature in the heater tank gets dangerously high. Overpressure will occur if the cold water inlet is somehow blocked, all faucets are closed, and the tank heats up. Overtemperature will occur if the thermostat fails and the heater (element or flame) remains constantly on. 

The opening of this safety valve is such a rare event that ordinances and good practice don't even require that it be connected to a drain. 

The "overflow pipe" in the diagram is merely a guide to prevent hot water from spraying everywhere if the safety valve ever does open.