Pilots eject from aircraft when it cannot be controlled any more. Ejection seems to happen without delay and few time to secure the aircraft and its weapons.
Pilot ejection, source.
Thanks to @RonBeyer for pointing out the Cornfield Bomber which also links to a notable accident in 1989 with a MiG-23 flying 900 km and several countries, uncontrolled:
During takeoff [from Poland], the afterburner failed and the engine began losing power. At an altitude of 150 meters and descending, the pilot assumed he had a complete engine failure and ejected. [...] After flying over 900 km (560 mi) the MiG crashed into a house, killing a Belgian teenager.
What are the procedures or features in place to prevent the aircraft to keep flying and explosives to explode?