We might very well have negotiated a satisfactory arrangement with the Taliban government with respect to terrorist organizations such as Al Qaeda taking shelter in Afghanistan had such an attempt been made. How hard could it have really been to convince any Afghan government, even the Taliban, that association with terrorists was against their own interests? To me that is comparable to persuading even an ardent animal lover that rattle-snakes don't make good pets.
The invasion was really more of an attempt to gain a client state for the empire than a sincere counter-terrorism exercise. Our subsequent efforts to guide Afghanistan to adopt institutions more compatible with our own lacks awareness of the weak support for that in current Afghan culture and is fraught with the danger for good intentions to go awry. We would still be better guided even now to focus mainly on the narrow objective of pushing the Afghans to reject hospitality to terrorists while observing throughout the precautionary principle to first of all to do no harm.