The fumbling about is produced by different people in the US government wanting different strategies, or sometimes wanting an objective for reasons unrelated to strategy (for example, the State Department types who want the US to keep enough forces in the MidEast to be able to veto Israel's actions).
There's several strategies we could have followed in response to the 9/11 attacks. Strategic moves aren't always intuitive. The US response to Pearl Harbor was to invade Morocco, a place even more removed from the Imperial Japanese Navy than Iraq was from the terrorists who organized 9/11. It made sense as a way to keep the Allies in the fight, expecting them to defeat Japan's cohorts and then Japan in turn.
Invading Iraq made sense as part of a strategy of transforming the Arab world into a series of democracies, or at least autocracies leaving people enough freedom that they had better things to do than strap bombs to themselves (Dubya did mention this as our strategy a few times, but didn't put much work into creating a national consensus for us).
Alternate strategies existed--simple punitive expeditions, imperialism, isolationism--each with their own ideal outcomes. I wrote about the choices here.
I didn't think pushing for democracy was the safest or cheapest strategy. I certainly wasn't sure it would work, though there were moments of hope. Instead I was worried about the worst case. Terrorists are being empowered by technology to cause more damage
Eliezer Yudkowsky expressed this as "Moore's Law of Mad Scientists: Every 18 months the IQ required to destroy the world goes down by one point." The same minimum IQ reduction applies to each smaller act of terror.
So someday in the future, if we haven't eliminated the forces driving terrorism, there will be an attack on the USA that causes over a million dead. And Americans, seized with rage and fear, will launch a counterattack with a hundred or a thousand times as many dead.
I wanted us to pursue the strategy of democracy to avert that. Because I don't want that much blood on our hands. At the very least I felt an obligation to try.
Now Americans born after 9/11 are enlisting and going off to fight in Syria and Afghanistan. Dubya's successors haven't stuck with his strategy. The guiding principle of our actions in the Middle East this decade seems to be "Do the minimum to keep people from complaining on the news."
I'm not shocked. Americans aren't much for generations-long commitments, certainly not if no one's taking the responsibility for asking them to. So that strategy is abandoned. We don't have a new strategy. There's not much point to deploying troops if we don't have a strategy for them to execute.
So, yes, as someone who advocated going into Iraq and still thinks it was a good idea, I think it's time to pull out of the Middle East. Playing whack-a-mole is not a strategy.
When the great atrocity happens, and a half-billion are killed in retaliation, a grandchild will come to me asking "How could everyone let this happen?" I'll point to the Americans dead in Iraq and Afghanistan (and Syria, Niger, etc.) and say, "We tried to prevent it."