Nationalism (and other forms of tribalism) are pretty much inevitably when ordinary people feel their livelihood is uncertain or threatened. Tolerance is a quality of secure & prosperous people.
The current rise of nationalism is IMHO a direct result of decreasing job security, worsening working conditions, disappearing pensions, failing public services, and falling wages across Europe and the USA.
Demonising nationalism won't help. What will help is job security, better working conditions, guaranteed pensions, robust public services, and wages that keep up with inflation.
This is not rocket science or ideology. It's a simple observation about what happens when people feel insecure and their livelihood is threatened. They tend to react badly and often violently when they can't feed their families.
Sure, they may scapegoat the wrong people, e.g. govts and the ruling classes are to blame, but immigrants might bear the brunt. But the idea that people are rational was always bullshit.
Don't be surprised when the masses get it wrong, after all they elected the people who took away their job security, etc. Don't be surprised when they act irrationally. They are scared and backed into a corner.
The rise of nationalism is the result of the capture of government by wealthy business people and the inequitable distribution of the profits of industry. This led to growing economic insecurity. And here we are.
You can't have a secure 1% at the expense of insecurity for the 99% and expect a stable and open society. You can only expect some crazy shit to start happening. And without fundamental reforms, it will only get worse.
I know some people are quick to point out that inequality is falling globally. True. Globalisation seeks to convert every human being into a consumer of useless products. Thus lifting the socio-economic status of the very poor is essential for the Globalisation project. But where everyone is already a consumer, it is important to weaken and divide them. Undermining their economic security does just this.
Also if someone earns a dollar a day, it's not that expensive to give them 2 dollars. If they earn the minimum wage in the UK, it is much more expensive to double their income. And the fact is that wages have been falling in the UK for 10 years.