I think you’re conflating Afghanistan with Vietnam. America never fully committed to Afghanistan as they did with Vietnam. From the very outset they tried to do it on the cheap by relying heavily on the northern alliance. Subsequent to the invasion, America was far more interested in pursuing the Iraq war, so Afghanistan quickly became a backwater.
This meant that America became heavily reliant on local war lords (some of whom had dealings with the Taliban) to ensure security and maintain order. This undermined the government they were trying to build in Kabul and contributed to a culture of corruption. None of which endeared the common afghan to their newly formed institutions. The Taliban exploited these weaknesses with classic insurgency tactics and gradually took territory from the weak central authorities.
This was all entirely avoidable, America just didn’t stay focused on the mission.
This meant that America became heavily reliant on local war lords (some of whom had dealings with the Taliban) to ensure security and maintain order. This undermined the government they were trying to build in Kabul and contributed to a culture of corruption. None of which endeared the common afghan to their newly formed institutions. The Taliban exploited these weaknesses with classic insurgency tactics and gradually took territory from the weak central authorities.
This was all entirely avoidable, America just didn’t stay focused on the mission.