I don't for one second believe we will be any less likely to be attacked if we pull out now

If nothing else they won't forget we've been there for years, we participated in Afghanistan, etc.  For your tactic to work we'd have to be out for 10+ years.  But even then, I suspect the terrorists would still lump us in with the US since I doubt they have a grasp of geopolitics.