Actually it’s a topic containing some very uncomfortable facts. A country has to choose between a high standard of living with immigration/foreign workers or a lower one without.
Let’s start with the most extreme example - Nazis. They’ve taken racial purity to it’s genocidal extreme, yet they were forced to abduct/cajole/force millions of foreign workers into Germany proper to meet the needs of it’s industry at the time when Germany was the de facto economical center of continental Europe. This doesn’t include millions of slave laborers in concentration camps.
Second example - apartheid South Africa. After the National Party won the 1948 election bent on formalizing already existing white supremacy and racial segregation, there was an intense debate on how to achieve this morally reprehensible goal.
One wing of the Party advocated the concept of total segregation - whites and non-whites living and working in physically and geographically separate entities, thus creating a whites-only area.
Unfortunately, the plan hit a snag - labor. Rapid industrialization of SA during and after WW2 created a huge demand for cheap, skilled and semi-skilled African labor. Thus, any introduction of “total segregation” would cripple the nascent industries, drive wages and prices sky high and drastically reduce the standard of living of the white minority.
Since the affluent part of the white electorate was not prepared to sacrifice it’s luxurious standard of living with black maids and gardeners, as well as third world wages for their industry’s workforce, apartheid was born - a concept where a non-white person, residing in a designated non-white area traveled to work through an intricate system of checkpoints and passes to work in a white area. Called nominally a “transitional period” towards a time when whites would fill all employment positions, it created a veritable tide of non-white labor as well as illegal immigrants from other African countries, as even the lowest paying jobs in SA were better than what they had at home.
Notice a pattern here? Two systems hell bent on racial purity couldn’t function without what you would call immigrant/foreign labor.
So either your country is a net exporter of human capital or a net importer. If you’re a net importer, you need a country-wide consensus against immigration and the negative effects on the economy this stance entails. Hungary seems to be accepting this, from a justified fear of migrants, at least for the time being. I understand there is a tacit cultural barrier in Japan as well.