This is a recommended procedure for many aircraft. For example, the engine fire checklist for a C152 goes:
Mixture – IDLE CUT-OFF.
Fuel Shutoff Valve – OFF.
Master Switch – OFF.
Cabin Heat and Air – ...
The way it's been shown, as the first and only response to a fire, it's fictionalized, but it's realistic that the pilot might dive.
The procedure for extinguishing an engine fire begins with shutting ...