The heat in the cabin comes from the heater matrix which is heated by the engine coolant. So its basically adding additional cooling, which gets rid of the extra heat thats overwhelming the cooling system when its just the normal rad.
When the headgasket goes it can cause gas to seep into the coolant from the cylinder, that gas is hot, which is what causes the heat to rise.
so basically failed headgasket, add temp to the coolant system, cabin heater takes that extra heat out of the system.
hopefully that makes sense.
you can try a sniff test that looks for exhaust gases in the coolant, although its not always 100% reliable.