This has already happened in New Zealand. If you've ever publicly made controversial statements ("have ever publically made a racist statement" [1]), they can deny you a resident visa unless they arbitrarily decide it's OK.
You might think you're not a racist, but in the UK, racism law extends to criticizing Islam or even questioning aspects of it. So you better not be an outspoken atheist either.
[1] https://www.immigration.govt.nz/new-zealand-visas/apply-for-...