Have you ever contemplated that the "racist, xenophobic and homophobic" behaviour is what is keeping those communities and used to keep other communities homogenous and thereby ensured high-trust?
In that case the xenophobia acts like the immune system but for a community/society.