It's my recollection that the .40 came into being not because the 10mm was beating shooters to death, but because it was beating the pistols to death. The FBI downloaded their 10's to protect the Colts, somebody noticed that you could get the same performance with a shorter cartridge et viola! .40 S&W.
Assuming one or two things-- those being that you are large enough and strong enough to control the recoil, there is no case in which the 9 as a single bullet outperforms the .40 with a comparable bullet. Okay, the 9 expands blah blah. So does the .40, but it starts out bigger. Same same .45.
When the .40 first came out, I was carrying .45's or .44's I did the math. It seemed like a viable compromise between capacity and power. I'd give up the latter for more of the former.
Would I carry a 9 back then. Fuck no! Despite all of the hoopla, my coincidence meter just can't get past the fact that the 9's were considered effete Eurotrash guns right up until the US military adopted the 92, at which point they magically and instantly became "teh bestest boolitz in teh wurld!" Oddly, they were still pushing a .355 bullet only a little faster than the old .38's that were universally looked down upon as antiques.
Of course, back then, we were still under the misapprehension that pistols were more than "a thing you use to get to the rifle you never should have put down." Back when the average number of shots fired in a personal confrontation was something like 2.3 rather than the 20-30 they are today.
You can skirt almost any law there is, right up until you get to physics. That law is pretty well set. mass and etc, y'know? bigger, wider, faster. Any adjustment in one requires one or both of the others to step up its game.
In the end, it's all up to the shooter. If you're going to carry a piece, carry the biggest one that you can readily carry (because leaving the cannon at home isn't as good as bringing a slingshot with you.) and the largest caliber that you can reliably shoot accurately. A pistol you don't have with you is worthless, and one you can't hit with even moreso.
OTOH, at the end of the day, the difference between 15+1 and 17+1 is negligible if you're actually hitting what you're aiming at. If whatever you're shooting hasn't gone down for keeps by 15, you're probably dealing with something that's going to take multiple mag dumps or a rifle or shotgun.
Can't shoot a .45, or can't carry one with a large enough capacity to suit you? Carry a .40. Can't shoot a .40 because of the horrible (
) recoil, carry a 9. Can't carry a 9 because.... uhm... reasons, carry a .32 or .380. Hell, carry a .22lr if that's all you can handle/carry comfortably.
There was a time when the death knell was sounded for the .44spl, the .32acp, and even the .380. All of them are still relatively common. I can even still get .38-40 if I really want to. (ballistically almost identical to .40 S&W in the same way that the old .36 is nearly 9mm)
Getting back to the original topic, the .40S&W ain't going nowhere, nor is the 9 until the U.S. military adopts a different pistol cartridge, at which point I expect that the 9 will lose favor and this new one, whatever it may be, will becom AWESOMESAUCE! and acquire the same magical properties that 9 now enjoys.