In 20-20 hindsight, the proper thing to do with Afghanistan would've been to subdivide it into four countries more or less along tribal lines with the Taliban getting the southern third around Kandahar and the northern two thirds to be subdivided among Turkmenistan, Uzbekistan and Tajikistan, all of which are Islamic kleptocracies but none of which export terrorism.
The rump Taliban state could then be warned that exportation of terrorism would result in being bombed back into the stone age but their medieval kleptocracy would be left alone.