It isn't just a matter of invading them.  We have also armed a number of despotic leaders over the years.  When those leaders kill their own people with weapons made here, we become the bad guys.  It is extremely complicated and there aren't any truly simple solutions, but we really have caused much of this chaos and our policies are much of why they hate us.  It isn't because of our freedoms or because they hate anyone who isn't Muslim, it is because we are seen as the bad guys for either actively killing them, or helping their leaders do it.  There is a smallish group that really does hate for the reasons you think they do, but they get recruits because of our actions.  We, as in the west, have caused this and while getting out of the Middle East isn't going to magically fix everything, it is a start.