clearly the US military (not just the political leadership, the military) did not have a clear notion of what an occupation/liberation of Afghanistan would mean and how best to do it if it was needed. I have no doubt that when it comes to an actual tactical maneuver (capturing position X, securing position Y or patrolling down track Z) the US army is one of the best in the world. And without a doubt when it comes to big firepower high tech stuff, its simply in a class of its own; but generals have to be able to think beyond that and the US army does not do a great job of that. It wasnt just the job of some hack in the state department to plan for "the day after" in Iraq, it was General Frank's job and he didnt do it. Same thing in Afghanistan.
And in both cases a reasonably successful outcome (by current standards, a very satisfactory outcome, but of course, not by "ideal" standards, i.e. the standards that are the norm in the liberal imagination) was possible with less treasure and blood then was spent on sub-optimal outcomes.