In Iraq though, it was always going to be messy simply because of the fact that there are three major ethno-religious groups, two of which had been long repressed. I don't know enough of the details about the 2003-2005 time period to really specifically address radical de-Baathification, but if you institute democracy in Iraq and keep the country together, you're naturally going to get de-Baathification because the Shia will vote the Sunni out. The Sunni will resent this, and as we've seen, this is how you wind up with ISIS.
Easily a 50+ year project, because progress effectively happens one death at a time. A large percentage of the old guard harboring outdated ideas will simply never change. The only hope is changing the minds of the new generations.
Post 9/11, the USA had the moral authority to "do something" in Afghanistan. Iran, Russia, and nearly everyone else offered to help. Alas, whereas GHWB was an internationalist, the Cheney Admin's neocons were belligerently stubborn unilateralists. So instead of seizing the opportunity to reset troubled relations (and boost their internal reformers), we further spited them (and empowered their hardliners).
Further, Afghanistan was a failed state. Iran and Pakistan were struggling to manage the refugees. And could do nothing to address the flood of drugs plaguing their people. Afghanistan's neighbors wanted us, needed us, to help them restore stability.
Lastly, the Cheney Admin won in Iraq without firing a single shot. Hussein conceded to ALL of our demands. If Bush had simply declared victory and gone home, he'd've become an int'l hero and considered one of our greatest presidents. (Until Katrina.)
Such a stupid waste. So many dead, so much wrecked and wasted, the middle east further destabilized... Et cetera.
Afghanistan was never going to be easy to succeed at something more than a punitive mission against al-Qaeda, but I think that the fundamental root of much later failure including the ultimate failure in Afghanistan is the 2003 Iraq War.