I won't deny the UK doesn't have issues with race but it is not the US. Here class politics matter far more. Electing a multimillionaire married to a billionaire was never going to end well electorally.
You forget the voterbase for choosing the Conservative Party leader. Conservative Party members skew older, whiter and more racist than the general public. Although in this case being the man who defenestrated Johnson didn't help his chances.