They didn't leave Afghanistan after the Soviets left, why do you think they'd leave Iraq if we left?
Because they were able to be sustained by locals in Afghanastan...and that is far less certain in Iraq.
First, the majority of the Iraqi population is Shia. They are heratics, according to the AlQeda and this even worse than Americans. So, Shia -- supported by Iran -- will fight AlQeda as a religious duty and part of their own self protection.
Second, the Kurds make up a large population segment. The Kurds are not Arabs. Their not historically interested in restoring a "Caliphate" so much as they are establishing an indipendent Kurdish homeland. Indeed, their inspriation has been Marxist and Marxist revolutionary. Their revolts have been secular and nationalist. Their home land incompasses not just Iraq, but also Turkey, Syria and Iran. They've little interest in following religiously driven Arab fighters...many see their battles as agains Arabs. They will in short, limit ALQeda's ability to win in Iraq.
Third, secular Sunni's exist in Iraq. They are often former Baathist, they are secular, quasi-socialist and quasi facists. They may work in concert with AlQeda -- and have -- but they see their struggle in terms of an indipendent Iraq run by them...putting the Kurds and Shia in their proper place (i.e. a return to the old order). However, there are enough seculars among them that they will ultimately not support AlQeda and be very suspicious of the forigen element tha AlQesa brings to the fray. They want America gone, they also don't want to be dominated by Saudi or other Arabs. To the extent that AlQeda in Iraq is an internationalist movement...it wil fail.
Fourth, AlQeda didn't win in Afghanastan...the Taliban did. The Taliban were Afghan/Pakistani tribal groups that embraced a certain kind of Islamism as part of their battle against the Central state. The Taliban were a home grown movement of the tribal areas. They accepted AlQeda support, but the Taliban and AlQeda are different. AlQeda never ruled Afghanastan, the Taliban did. The Taliban gave AlQeda heaven and embraced much of the AlQeda message...but the Taliban were really concentrating on securing their own gains in Afghanastan and the in the tribal areas of Pakistan, it was a full time job.
The point is that while those who became AlQesa helped throw the Soviets and their puppets out of Afghanastan -- as did the US, BTW -- it was a Taliban victory not an AlQeda movement.
At most, in Iraq, it would seem that whatever AlQeda in Iraq is, it isn't currently a movement likely to take the country...rather a movement more likely to be a persistent pain in the side of any government in the region. Not unlike the anarchists and social revolutionaries at the turn of the 20th Century.
The question than becomes: should we stay to fight them? If we are gone, ALQeda in Iraq will continue to pick at the Iraqi state, but there seems little that would lead one to the conclusion that they would be able to focus much effort beyond their struggle for the Iraqi state. In other words, they will be focused on their battle for Iraq, not -- like the AlQeda in Afghanastan/Pakistan -- focused on extra-territorial assults. Next, it is a minority movement -- even our own intelligence and military puts them at a core handful (a couple of thousand, I think) out of a population of many million. Third, most of the local elements while thirsty to see the Americans go and go soon, would not embrace AlQeda as leaders of a new Iraq -- the Shia alone can be counted on to kill as many as they can find.
So, ultimately, AlQeda in Iraq exists and acts almost precisely because we are there. Without our presense to sustaint their battle cry and to engender sympathy among locals who want Iraq for Iraqis, they would be, IMO, even more minor players than we are.
In this regard, this Administration has really dropped the ball because the most dangerous AlQeda is the one we fight in Afghanastan/Pakistan...the one we've put far fewer resources into fighting.