2. Baghdad is not a Sunni Town. It is run by the Shia, who will actually fight for it. Militia's fighting with actual determination can turn urban warfare into a bloody nightmare. For all it's resources and men, ISIL is still fighting a war on two and a half fronts - against Iraq, against Syria, and to an extent against other extremist groups who might take advantage to impinge on its territory. It is unlikely they have the ability to forcibly seize and hold a city the size of Baghdad against the will of its populace while also holding on to what they have already taken.
3. Baghdad is defended by Qods Force - Iranian Special Forces. These are the guys who gave us the Explosively Formed Penetrator, and almost caused a political swell at home large enough to drive us from Iraq. And Rouhani has already stated that the desecration of any significant Shia shrine would be a red line for him. My bet is, unlike our current feckless administration, he actually means that.
“If we must have an enemy at the head of Government, let it be one whom we can oppose, and for whom we are not responsible, who will not involve our party in the disgrace of his foolish and bad measures.”
- Alexander Hamilton. Spiritual father of #NeverTrump