These were all American defeats, but all different. And the defeat in Afghanistan is much more than an American defeat.
In Vietnam, America and its Western friends were not alone, and they did not dominate technologically.
They did not have air superiority over the North, a crucial rear area for the Vietnamese. The North had formidable missile defenses and useful fighter assets. In the South, US air superiority was not complemented by technological superiority. The Vietnamese had good, modern assault rifles, artillery, and other assets. On the other hand, the US was not fighting alone. There was something resembling a civil war, with the communists opposed by deeply entrenched and largely united governing classes. That was why the South Vietnamese army was a real army with real desire and capacity to fight. The defeat of the US was very important, even catastrophic for American morale and self-confidence. American losses were considerable. But that defeat was against an opponent with roughly comparable strength given almost unlimited Soviet backing. This was the first war America lost that it really wanted to win, and it gave everything it had to defeat its enemy. But it was nothing like the defeats to come.
In Iraq, the US was fighting an opponent which, despite its pretensions, was aggressively secular and just plain aggressive. It had made mortal enemies of most of its neighbours and all of its substantial ethnic groups, including a majority Shia population. In the first Gulf war the US had therefore been able to assemble a genuinely international coalition. Though the Iraqi forces were strong, they were overwhelmed. In the second Gulf war, the Iraqi state was so weakened that it could not seriously resist.
The US was, nevertheless, defeated. It never established control of the country. It struggled to suppress the secular Sunni resistance. When that threat was greatly diminished, Sunni resistance morphed into ISIS. Here American air superiority enabled the US and its clients to retake all of ISIS territory, but - crucially - not without the active military support of Iran and its proxy militias, and not by eliminating ISIS itself. The US decided it could not, at reasonable cost, maintain control of the country. Therefore it turned the country over to Iran, which has dominated Iraq ever since. The occasional application of US air power hasn't the slightest prospect of changing this political reality. No, this is no one's official story, but it does represent the facts. Here too the US lost the war, because the US failed to achieve its objectives and Iran - an enemy the US acquired before the defeat of Saddam Hussein - did.
These defeats both mattered enormously. Vietnam did permanent damage to the American spirit, and emboldened its enemies - but comparable enemies, with comparable support, haven't materialized. (9-11 made its own generous contribution to the American malaise.) The defeat in Iraq had only modest geopolitical consequences, but further indicated American weakness, in this case versus a third-tier military power, bolstered with extensive, popularly supported local forces.
Yet the defeat in Afghanistan was of a different order, probably a great catastrophe for the entire 'Western' world, with 'Western' denoting the US and the nations under its nuclear wing. In Afghanistan, unlike Vietnam, the US had absolute air superiority, as it did in Iraq. But in Vietnam and Iraq, the US eventually ceded the field to forces which, though inferior, had considerable military and technological strength.
Afghanistan was different. Unlike Vietnam but like Iraq, the US had absolute air superiority, and the enemy had no vast jungles for concealment. Unlike both Iraq (in the later Iran-sponsored militia phase) and Vietnam, the the US faced an enemy who had no secure sanctuary or extensive source of relatively advanced military material. The US had allies from most of the Western world - why not? with air superiority, the involvement was cheap and great for sucking up to the Americans. The enemy had no militarily significant allies, much less a border with any of them. Pakistan, while offering the Taliban very modest backing, committed almost nothing to the fight while providing resupply routes for the Americans. Indeed the Taliban did not even have friends throughout the territory. The struggle was about as uneven as, even in theory, it would be possible to construct. Yet the enemy's victory surpassed all the victories of all the better-positioned US opponents.
Never before have the US and its Western allies been so thoroughly expelled, so quickly. And never before have Western efforts to rely on proxies been so thoroughly held up to ridicule: it does not matter whose fault that was; it matters that, despite gargantuan efforts, it failed decisively. With almost nothing, the enemy reduced its Western opponents to almost nothing. And the key to its victory is no mystery: the enemy was willing to fight forever, at any cost the West was willing to impose. The West was unwilling to fight, except at arm's length, and that wasn't even close to enough.
So events have established the following. The US does not command 'unparalleled' military might, period. The US can and often does establish air superiority, but not military superiority, in this case meaning the attainment of set objectives through military force. Military superiority doesn't mean how much stuff or how many special forces sit on some list or on some bases. If, for whatever reason, you're unwilling to use those resources, military superiority is a fantasy. And the Afghanistan débacle has shown, conclusively, that the West is too averse to risk and suffering to use them. What's more, that aversion has steadily increased since the Vietnam era. It follows that in any conflict with a determined, intelligent enemy, whenever the country and population are large enough, the West is very likely to prove, in the old phrase, a paper tiger.
It's hard to say whether this has penetrated Western consciousness. Certainly the embarrassing posturing about sanctions, conditions, Taliban technical deficiencies, and disaster in the wake of Western withdrawal all suggest a lust for distraction from the nasty, blatantly humiliating truth about Western weakness. But the West's defeat should be frightening even for those who enjoy Western humiliation.
When so many forces in so many places can overcome Western military power, itself emasculated by societies' incurable distaste for bloody, open-ended engagement, what's going to happen? Will future victories over the West usher in onlyTaliban-style Islamists, or a regionally dominant Pol Pot, or some even more vicious Pinochet? Will the West, ever incapable of providing a serious military response to any serious problem, stave off ever-increasing, ever more extensive political, social and environmental disasters? One may well ask.