Replacing toilet shut-off valve and need to turn off water; Need to turn gas water heater to pilot?
Do I need to set the water heater to pilot, in order to avoid the
dangerous scenario outlined above? Doing anything to our water heater
makes me a bit nervous.

NO, In the amount of time that it will take you change the valve there will be no issues with it set to the current temperature.
Once you turn the water off, even if someone opened a hot water faucet there would be no water pressure to push hot water out of the water heater (WH), so the WH will not need to fire up.
Once you turn off you main water supply you will want to open all the faucets in the house to bleed out what you can of water in the pipes to minimize the amount of water that come out of the toilet supply pipe when you remove the valve. You can turn it to the pilot setting if you want to feel more at ease, its easy and the pilot will stay on so no need to re-light it.
The boiler is a closed system, except for a one way valve that is designed to add water to the system if it runs low. It will not &quot;empty out and run dry&quot; if you shut of the main water supply for a short time. You can turn off the power to it if you feel you need to.