After reading your posts, you are obviously a civilian gun owner and shooter, and have no idea where pistols fall into the military framework. The Spec Ops people, the folks who might actually get into pistol fights, pretty much carry what they want and are issued weapons accordingly. Some even have been known to carry personally owned handguns and the leadership "looks the other way" (this is based on first hand information, not what somebody "told me"). Generally speaking general issue pistols like the M9 are issued to personnel such are military police, aviators, and staff officers, and some crew served weapons personnel. Most everybody else gets an M4 or an M16. I was issued 1911's and M9's and I loved them. Why? Because they were easy to carry around and when we went to the field, very portable, BUT, I was part of the Cold War Army. If things got hot I vowed to get myself an M16 very quickly, either by going to see the armorer and demanding one, picking up one on the battlefield, or trading my pistol for one from the youngest dumbest private I could find who thought somehow that having a pistol would be neater than having a rifle.
As Clint Smith, one of the truly great firearms trainers of our time said: "Never bring a pistol to a gunfight" holds doubly true for combat. If I am one of the troops who is issued a pistol as primary weapon and have to rely on it, then I know that I am in very deep kimchee and the enemy has made some serious inroads into my area of operations.
There is a mystique to the pistol in the military. Perhaps because it has been traditionally been associated with rank (officers are issued pistols and for decades general officers were even issued special pistols). James Jones a very good author even wrote a novella once called "The Pistol." I think a lot of enlisted soldiers covet pistols because they can't have them. I also think that many see having a pistol as an insurance policy as BUG. I don't have a problem with this personally. Many years ago, time Major George Nonte, a gun writer most of you don't know of, but who was one of the best gun writers of his time, said why not equip each infantry man with the then new model 60 Chief's Special as a BUG? His rationale was that in the jungles of Viet Nam it might be great for back-up especially when infiltrators hit at night during down time. He said for the cost of one jet fighter an entire infanry division could be outfitted with these. Sounds a bit archaic today, but a stainless .38 was state of the art in the early 1960's. I know once Massad Ayoob opined that something inexpensive like a Kel Tec in 9mm would make a nice BUG for troops. A pistol as a back up to the primary weapon is an idea that does have merit but will never be adopted.
Another angle, you go walking around with a pistol, an enemy sniper sees you and this screams: officer, and you have made yourself a target.
So, while pistols might be important to civilians as PDW or to the police, they just aren't too important to the military which is one reason why the M1 Carbine was developed in the early 1940's. The War Department wanted to try to get rid of the pistol entirely but couldn't, so they developed a shoulder fired carbine that fired an intermediate cartridge with the approximate power of a .357 Magnum out to 50 yards. This was very successful and within the parameters of its original concept great, the problem is that it was expanded outside the original concept and some began seeing it as a main battle rifle, even with sniper variations. The pistol will probably never totally go away in the military, but it is of extremely limited value in most military applications. If the United States Army or the United States Marine Corps finds itself in a bunch of pistol fights where they come up short, you can damn betcha a newer more effective handgun will be issue, happened once and the result was the 1911. We are beyond that now and I am not saying go back to that platform. The need is just not there at this time for a major overhaul of our pistol requirements. Personally I think the M9 or some variation of it will be around for some time.