1.) Kyiv is 50mi from the border, Baghdad is 200mi.
2.) Iraq was a numerically far superior force to the coalition, with >500,000 active soldiers and >1.3 million total. Clearing out that many people simply takes time.
3) The coalition moved slowly and largely neutralized resistance along their way, they didn't skip settlements or cities. Russia is trying deep strikes and bypassing/avoiding many of the larger cities/settlements. And those places are not necessarily under any kind of coherent siege at this point either.
4) Coalition losses in the entire war, where they were again, fighting a numerically far superior force, were tiny. ~200 killed. Estimates of Russian losses so far are 10x+ that and with a lot of lost equipment.
I'm not suggesting I think the Ukrainian position is great or that they're poised to win other than via long insurgency, just that I don't think the comparison works.