I own several 40s&w firearms. It's my favorite caliber, and it's many other's favorite caliber as well. It's not going anywhere. It's a matter of time before the powers that be convince the followers and steeple that 40s&w is cool again. Right now they've been convinced to hate 40s&w and to buy 10mm instead.
They will complain that 40s&w is too snappy, but then will rave about 10mm which is typically almost always loaded to be 40s&w in a 10mm cartilage in the overwhelming majority of commercial self-defense ammo. Even for the small percentage of reloaders and boutique commercial loads, they will be even more snappy than 40s&w, yet no one whines and complains about recoil when threads and the topic comes up (funny how that works). They only complain about it in 40s&w because they're followers who are regurgitating talking points. Buy a G26, G19, or G17 sized handgun in 10mm to carry for self-defense and everyone applauds and nods their heads in approvement. Mention 40s&w, and everyone will pontificate with contempt about how much they dislike or will never buy 40s&w when 10mm is just as or more "snappy" than 40s&w, will have follow up shots that are simular or worse than 40s&w, but will cost more per round than 40s&w, be in a larger diameter gun than 40s&w, and basically have all the same cons and non of the pros vs 40s&w.
There are millions of 40s&w handguns still in circulation. There are A LOT of people who still love the round. There will always be ammo for it.