@David Thomas good question — TX power and PHY selection are independent parameters on the STM32WB07 at the hardware level, so switching to 2Mbps PHY doesn't automatically step down your output power. They're separate settings in the BLE stack configuration.
That said, the long-range capability leans heavily on the coded PHY (S=8 specifically) combined with the external PA and the receiver sensitivity optimizations Moamen built into the RF front end — the 50km figure is drone-to-drone with coded PHY, not 2Mbps. At 2Mbps you're trading sensitivity for throughput, so even at full TX power your practical range will drop significantly compared to coded PHY, which is exactly the tradeoff you'd expect.
For your use case of dynamically switching between the two modes, you should be fine controlling PHY and TX power independently through the firmware — the AI Firmware Builder in the Dev Hub is actually pretty decent for scaffolding that kind of adaptive PHY switching logic if you want a head start rather than writing it from scratch. Worth a shot before going deep on the BLE stack API directly.