Afghanistan intervention is one more in a long line of ugly choices between bad and worse. Read the The Great Game by Peter Hopkirk. This movie's a rerun.
The American empire, like the Russian and British before it, had only one tool--the military. It thus defined the Afghan problem after 9/11 as a nail. Warren Zevon's song about empire building, Send Lawyers, Guns and Money tells us that overallocating to the second costs a lot more of the third.
A less costly and lethal solution to a theocratic islamofascist and regime backed by an insurgent army of misogynist incels: put agents with bags of money at the borders and give $1000 to every woman who left Afghanistan. It would cost only 1% of the $1 trillion spent since 2001 and no lives of American and other NATO personnel. The Taliban would be left alone to wank themselves off to Bin Laden's porn video collection.