Hindsight is a wonderful thing.
In hindsight, we (a US-led coalition) could have gone in with a 50-100 year plan to allow the nastier influences in Afghanistan to grow old and die, while "our ways" became embedded. This smacks a little bit of "empire" but ... what the heck?
Alternatively, we could have just gone in after Bin Laden then left when we didn't find him, or not even gone in at all.
We seem to have fallen between two stools. If I had been living in Afghanistan for the last twenty years, I'd be forever grateful for the 20 years that the overseas forces had given me. Those 20 years would be worth a lot to me. And I'd now be rather resentful at the sudden departure, and crapping myself for what the future held, and probably looking for a way out of the country. Or, at best, prepared to give it a few months to see how it went, and then look for a way out.