One thing not mentioned about the pilot shortage in the military (and specifically the 2,000 number mentioned in the USAF), is that this shortage of pilots isn’t a shortage of pilots to fill cockpits; it’s really a shortage of pilots to fill staff-coded billets. Yes, there is a shortage of experienced IPs, but that’s because many of them are at a point in their careers where the machine wants them to go to staff, taking them out of the cockpit. But, by that point they have likely reached their commitment and leave instead, and most of which leave for the airlines.
There is no shortage of young pilots in fighter/heavy squadrons. In my neck of the woods teaching UPT, we have a boatload of new pilots who keep getting their IFF and B-course dates continuously pushed to the right due to backlog at each level in the pipeline. Hell, we can’t even crank out pilots through UPT fast enough with the aircraft fleets breaking at record rates since we are abusing them so much. Hence the “great ideas” like PTN to cut corners and create pilots faster. But I digress...
Bottom line, at least on the USAF side, is that currently well over 90% of pilots that reach their initial commitments and decide to leave do so for the airlines, since they are current and are at the pinnacle of their military flying careers. Those who stay longer for that sweet $35k bonus were going to do so anyways, and most of whom will spend the latter half of their careers rotting at a desk.