The U.S. could have participated only in targeted strikes against Al Qaeda, leaving the rest to local forces as a local matter that isn't our business, and not tried to occupy the country and engage in nation-building.
If they had done just a targeted strike against Al Qaeda, larger in scope but similar to what they did against Bin Laden's compound in Pakistan, we probably could have gotten Bin Laden years earlier and not spent more than a decade trying in the morass that is Afghanistan.
Our mistake was deciding that we needed to get rid of the Taliban and build a democratic nation from what was left after they were gone. There was never any hope of that; the Taliban just fled to the hills, to Pakistan, or just blend in with the local population because many of them are the local population. We have failed at building a nation that can take care of itself after we leave; within a year or two, the Taliban will be in power again.