As an aside, Japan but not Britain does a "good" job at limiting immigration despite the great need for it within their economy. Their bet is that the pain to their economy is worth the stability of their society. I suppose we shall see who has the better answer an open economy like the UK or a closed labor economy like Japan.
Also, this not a phenomenon unique to rich western countries, south Africa, Nigeria, Kenya are also very keen on protecting their own labor markets from immigrant classes. There is a protectionist aspect but its not racial in nature. Look at the Mexican motto "Mexico for Mexicans" and how other Hispanics are unfavored in their economy. Imagine a European country having a similar motto...
Every time there's a conversation about "is undocumented immigration good?" the response from the press is "without immigrants we wouldn't have Google!!"
If they are a primary cause, then the correct response is just to accept that good things may have tradeoffs.