It’s extremely common for the mechanism that only allows the fuel to be turned on if the pilot is lit to work by having a thermocouple in the pilot flame. Some of these also power the controls (thermostat, for example) and some don’t.

Yeah blowing yourself up with a gas leak is common enough when you're working on these systems that it's pretty important to have an interlock there.