Where you "work" for the purpose of taxes can generally, in layman terms be defined as "where your butt is sitting when doing the day-to-day things for which you get paid." If you are in the United States doing your day-to-day job, you are working in the United States and, thusly, covered by US tax law, employment law, anti-discrimination ordinances, Medicare and social security and unemployment (FICA) requirements, etc. There are some exceptions, like journalist and musicians and sportsman visiting but generally, if you are working in the USA, you are paying taxes in the USA.
And not only you! Your employer too! US employers are required to make contributions to your social security and unemployment insurance, and as they are employing you in the United States they are required to file and pay these withholdings to the US government.
Because, basically, think of this with some evil intent--what if every person in the world decided to live in a country and work "remotely" for the "home office" somewhere else? "I don't have to pay for the roads or the firetrucks or the schools or the courts or the street lights in this country because I pay taxes 'back home' where my bank account and employer is located. I'm just living in this country taking advantage of the roads and firetrucks and schools and courts and street lights..." Yea, it doesn't work like that.
To help illustrate the point let me point out the tax situation faced by NFL, NBA and MLB athletes. Some of them have to file 20+ state income tax returns each year. Why? Because they play a game (and get paid) in different cities around the country, and for those days that they are in the state earning they have to pay state income tax to that state. The "jock tax" is based on the idea that they work in a state and have to pay taxes in a state. It's a bit messed up, but the mentality is such that the states often go after every dollar they can get.
Basically, you really need to talk to an accountant about how to structure this. You can set up a US company to handle your withholding and FICA paperwork, or you can work as a "self-employed" contractor billing your company for your work while in the USA (thus releasing them of the tax and paperwork liability) but saddling you with the employer's share of taxes, i.e. the self-employment tax that comes out of your earnings.
But your tax residency, and thus some liability, is going to be in the United States if that is where you are working.
p.s. the exclusion of the first 100k of foreign income requires 330 days present in a foreign country (Physical Presence Test) or another test (Bona Fide Resident) test which you may likely not obtain if you are spending 6 months in the USA.