This annoying auto-reprioritization of your headphone's Bluetooth connection (not just AirPods) has been a nuisance for years ...
OS 26 offers a brand new setting that can prevent your AirPods’ audio from automatically switching to other speakers.