One reason the coalition did not finish Iraq in 1991-1992 was it would have left Iran the sole big boy on the block. No one wanted that.
Despite the Gulf War, or the oil embargo of the 70's, America continues to become more dependent on Middle East oil to meet it's energy needs, thus committing itself to the region and trying to keep the lid on that particular pressure cooker. No real effort is made to change that.
Afghanistan was an easy decision. When the taliban and al Qaida fled Afghanistan for Indonesia, Bangladesh, Philippians, Pakistan, and other SE Asian vacation spots..... we obviously chased them to Iraq (you'd think there would be a few maps around the Pentagon and White House, maybe a globe, wouldn't you?).
Although there was slightly less support to attack Iraq as there was Afghanistan; popular support was still in the midsts of "war fever" post 9/11 and coming off a quick "victory" in Afghanistan. Those that stated they were against an attack on Iraq were labeled unpatriotic --- ask the Dixie Chicks what happened to those that voiced concern in 2002-2003. The Administration pushed for it, the public supported it, and Congress went with popular opinion.
The intel was bad, the justification worse, for going after Saddam. He and his boys were bullies and all about keeping themselves in power and intimidating their neighbors and own people, but he was never a direct threat to the U.S. Only 1 terrorist camp in all of Iraq, in the NE border, to train Iranian partisans to tick off his old enemies in Iran. Before occupation, Iraq was one of the most secular Arab nations you could find. No way he had any connection to al Qadia; they operated at opposite extremes in that part of the world.
More likely, they saw a country they could "take", which had oil reserves and a strategic location in the Middle East. My guess is the Administration wanted to create the equivalent of a friendly South Korea in the Middle East with U.S. military bases from which to project power, influence, and democratic ideals (while some get rich off of it all).
The Administration and Pentagon screwed up Iraq operations by the numbers:
* Too few troops to secure the country. They sold the war as a low number and short term expedition. Home by Christmas.
* U.S. goes to war with a force mix intended to fight the Soviets in Europe. Tanks and IFV's. U.S. force mix not tailored for low-intensity conflicts (despite previous experience in Bosnia, Somolia, and evidence of how modern conflict is evolving) which find armored cars more effective and depend on "boots on the ground". HMMV's (not to mention Hemmets and 929/930 5-ton dump trucks) pressed into service as combat vehicles. "Up armored" vehicles with "class 3 armor" become the norm (playing Mad Max in Iraq is not a lot of fun, from personal experience).
* U.S. plans originally intended to secure arms and munitions with Iraqi troops and police after the invasion.... then we fired the 400,000 soldiers, sailors, and airmen of the Iraqi military forces, as well as all the police (the people in D.C. who made that decision should be hung --- no trial, just hang them).
* With no one left to secure all the ammo dumps all over the country, they got raided. 4 years into the occupation, and there were still unsecured ammo dumps in Iraq. Those dumps were raided of munitions, and most of the soldiers killed by IED's were killed because the U.S. military failed to secure those munitions early on.
* 400,000 unemployed former military and police members (many who knew where much of the munitions were buried or hid in the country side in the first place) made for an easy pool to recruit insurgents to attack Allied forces. Patton did not make that blunder in Germany this way in 1945. McArthur didn't screw up post-WWII Japan this way. You'd think someone from West Point would have considered those two examples for the war in Iraq.
* Democratic Elections and "Freedom" (cue Mister Gibson please) touted as the cure all. Without security, democracy doesn't seem to stand a chance. The entire premise of all Iraqis coming together to sing kum-bay-ya comes down to western arrogance and a total disregard for the region, it's history, and it's people. Very few in Iraq are loyal to Iraq. Their loyalty is to their religious sect, their Allytolah, Mullah or Iam, to their tribe, to their clan, or to taking vengeance on whoever wronged them or their family eight generations ago.
A strong central government would have been a much better choice for an interim Iraq. Get the security -- then look toward democratic rule if feasible.
A report then comes out saying to bring Iran and Syria into solving the problem in Iraq. But Iran and Syria have no interest in a secure Iraq that is friendly to western powers. Syria and Jordan get to see their more troublesome citizens cross to Iraq to get themselves killed. Iran get to try an influence a Shii'a Arab led government friendly to their Shii'a Persian led government. The Turks worry about the Kurds. Everyone in the region has interests in Iraq, just not the same interests.
Now, in frustration, with popular opinion turning against the war in Iraq (and everyone now stating they opposed it at the beginning...rriiiigggghhhtttt tt), Congress wants to pull out. Unfortunately, that is a bad idea. We went in. We screwed everything up. To leave now can only push the region into further turmoil. 15 British sailors get taken by Iran, and the price of oil goes up. What does anyone think will happen to the region and oil prices if the U.S. pulls out of Iraq and the whole country implodes? $150+ US for a barrel of sweet crude and the total collapse of western economies?
I very much doubt there is a "good" solution to Iraq right now. It's come down to what's "less bad", and leaving the country to it's own devices just seems to be about the single biggest risk the western nations could take.
Meanwhile; 3 to 4 dozen terrorist training camps can be found in Bangladesh alone. Groups like al Qaida have come a long way in regrouping from their defeat in Afghanistan, since we took the pressure off them.
You can point to many problems from the past that led us to this point. I don't believe there are any easy or near-term solutions to be found. And I doubt there is the political will or popular support to reach any acceptable goal from this point forward. Certainly we lack anything like leadership.