Let's not forget that the Taliban had been out of power since 2001, yet they've persisted until they retook power in 2021. Not everything is due solely or principally to the Americans. Afghans have the power to decide too, and yet the Taliban have lasted this long despite strong American opposition during this time.
As the astonishingly brave Aghan politician and women's rights campaigner Malalai Joya has explained, the US allowed the murderous Afghan 'warlords' to not only survive the US invasion, but invited them into government.
https://www.nbcnews.com/news/world/afghan-anti-warlord-campaigner-malalai-joya-blames-u-s-violence-n660686 I can see the US rationale - it wanted to rid Afghanistan of the Taliban, not become entrenched in a full-scale war there. So even though the 'Northern Alliance' element of the Mujahidin (who'd split from the Taliban) were just as murderous, oppressive and misogynist as the Taliban, because they'd previously been in conflict with the Taliban during the later civil war once the Soviet forces left and the Afghan government collapsed, Washington embraced them, turning a blind eye to their human rights abuses and mass murder, and allowing their evil feudal systems to perpetuate.
As the US,'s own report by the Special Inspector General for Afghanistan Reconstruction (SIGAR) put it:
Many warlords were brought into government, where they continued their abuses, maintained private militias, and had links to narcotics, smuggling and criminal networks. U.S. partnerships with such individuals gave the Afghan population the impression the United States tolerated corruption and other abuses, seriously undercutting U.S. credibility.
https://www.sigar.mil/pdf/lessonslearned/SIGAR-16-58-LL.pdf The alternative would have been to wipe them out which, as the Soviets found out, isn't exactly easy.
That was the GWB era of hawkish neocons with their PNAC wet dream. They made idiotic mistakes - born out of arrogance and extreme naivete in both Afghanistan and Iraq.
When Obama was elected, he inherited a total mess, but still shied away from trying to make it right (to be fair, American public weariness with the two conflicts was huge). Afghan public support for the government had evaporated, replaced by cynicism toward their endemic corruption and their allowing medieval practices and oppression of human rights to continue outside of some cities that had at least least modernisation through more secularisation. Behind the scenes, the Taliban were organising again and attracting support from a disenchanted population (only the men, for obvious reasons)
Then the corrupt orange fuckwit paved the way for the Taliban invasion by smugly 'making a deal' with the Taliban, which saw him agree to the release of thousands of Taliban prisoners.
Seriously, whilst the US may be able to successfully plan a military campaign, they have been shown to be utterly clueless when strategising the 'what comes next' part.