is it true in a hot water system the thermostat controls the hot water valve and the boiler?
Domestic hot water or heating hot water? For a domestic system, the thermostat typically reads the tank or loop temperature and fires the gas accordingly to maintain a given temperature - this is as it relates either to a domestic water loop in a central heating boiler or for an indirect storage tank. For a central heating boiler, the thermostat typically operates the circulator and allows the system to call for heat. Various limit-switches on the boiler itself operate the gas-valve. Note that as long as the thermostat calls for heat, the circulator will operate whether or not there is flame. There are no hot water valves involved - unless you mean zone-valves. Those are individually controlled by a dedicated thermostat. In that case, when the thermostat calls for heat, the zone valve opens, the circulator starts and the flame is controlled by the limit-switches as-needed.
It's control the gas it tells the gas valve shut of the flame when the water heat up to certain temperature