Don't discount the .40 so quickly.
So
what if the .40 ... which has served LE and private owners well since '90 ... has become the
number 2 LE caliber in recent years? That's still a respectable position.
There's still a
lot of .40's seeing LE use, and if Glock didn't think the sales were there to be made, they wouldn't be trying to get their Gen5's chambered in .40 out on the market in LE hands (and looking to replace Gen4 .40's with new Gen5 .40's).
Sure, the 9mm has become the choice of many LE agencies (and their trainers) when it comes to fielding, equipping and training new shooters. Unsurprising. It offers less recoil to shooters and helps make ease some maintenance/repair concerns.
Doesn't mean the .40 is on life support, though.
These things come in waves, with an ebb & flow to "popularity". The 9mm spent the last 25+ years being in Second Place behind .40 S&W in LE/Gov circles, and now it's exchanging places with the .40 S&W. Give it another 5, 10 or 15 years and see what's in everyone's holsters. These things can keep coming back around.
Now, the .45ACP has managed to surprisingly maintain a respectable 3rd place position as a duty caliber among LE users.
It's the .357SIG that's experiencing an increasing loss of use among LE/Gov users. It's 4th place position is falling back and getting a bit further back there in the distance.
OP, your problem wasn't the caliber of the ammunition used in your mags, so much as you forgetting to bring another one.

Easy to address next time.