I agree that many/most Anmericans would have a different outlook upon foreign troops being on American soil, compared to U.S. troops being in another country. Still, I think the circumstances greatly affect how the presence of troops is viewed.
Usually, American troops occupy bases in countries where the United States is provideding military support/protection. The presence of those bases does, or should, help the people there to feel safer. Also, when our troops enter a country it is torn by strife that its own military/police cannot mannage (or perhaps are part of the problem). We are seeking to reestablish order -- again, hopefully making life safer and easier for the populace.
If the U.S. were similarly unstable, with fighting amongst various segments of the population -- kiilings, rape, etc. that our own military/police were unable to control, I think Americans might then accept . . even welcome . . the presence of military personnel from England or other countries deemed friendly to us (not saying that every country U.S. has entered considers us friends, but we are the big boys and its not uncommon for us to enter countries and end up rebuilding and defending them . . I'd say that is rather friendly, wouldn't you?)