As you yourself have pointed out, the situtaion on the ground is similar in both countries. Clearly many Americans feel that the situation is worth the trouble in Afghanistan but not Iraq. And the "political attempts to deligitamzie the Iraq war" might also be described as the "legitimate opposition to war we shouldn't have gotten into." Your argument seems to be "Never mind why we went in to Iraq--the important thing is now it's just like Afghanistan so we need to stay there just like we're staying in Afghanistan. " It's not the most compelling argument in the world.
Well, it wasn't the Democrats who dragged out the "Mission Accomplished" banner. I defy you to show me how the Bush administration advised our country as we entered into this conflict that this would be a long and bloody struggle that would consume years and years of time and billions and billions of dollars.
Remember, the majority of Americans continued to the support the war up to the summer of 2005. The length and cost of the war are primarily to blame for reversing the former majority support for the war.
I think its important to remember the reasons for going into both countries as well as understanding what has worked and what has not in each over the past 5 years. But the fact remains that the goals and reasons the United States are in both countries today or different from the reasons the United States invaded both of them 5 to 7 years ago, and whether or not the United States to decides to stay in either country should be based on what is happening now as opposed to the situation prior to the invasion.
It is very hard to predict before any sort of military intervention or exactly how things will occur. Bill Clinton never predicted how long the United States would be in Bosnia or Kosovo or how many casualties would be suffered. Bush never predicted how long the United States would be in Afghanistan or Iraq or what the cost would. Sure there were some government estimates out there, but those were wrong for all four conflicts. If the Bosnia Serbs had resisted to the extent that the Sunni Arabs in Iraq have, you would have seen a similar situation in Bosnia in the mid-1990s. If the United States had been forced to invade Serbia proper during the Kosovo conflict, again you may have seen a similar situation to Iraq. Those were real possibilities. Afghanistan gave the Soviet military tens of thousands of military casualties during the 1980s, and most experts believed and occupation of Afghanistan would prove much more difficult than that of Iraq.