Juan Cole has a reality-based version, No, Obama did not found ISIL, Mr. Trump: That was the GOP Informed Comment 08/11/2016:
So Obama was not asked to stay in Iraq by the sovereign Iraqi government, and international law made it impossible for him to keep troops there in a war-fighting capacity without an extra territoriality provision.
He simply abided by the agreement worked out by the Bush administration.
In 2011 when the civil war broke out in Syria, the elements of the ‘Islamic State of Iraq’ that had evolved out of al-Qaeda in Mesopotamia went to fight in Syria. Obama had nothing to do with that development.
There had been no al-Qaeda in Iraq before Bush invaded. Operatives flocked there to fight the US troops, and gathered under the rubric first of al-Tawhid of the Jordanian Abu Musab al-Zarqawi. But al-Zarqawi initially had bad relations with Usama Bin Laden. In order to fight the US presence, he made up and joined al-Qaeda and formed al-Qaeda in Mesopotamia. AFter he was killed by the US in 2006, the new, Iraqi leadership declared itself the Islamic State of Iraq and deepened their al-Qaeda affiliation.