I've always regarded his 'racism' as a manifestation of the general anxiety about the unknown he clearly coped with through his writing. For a man with his particular neuroses, growing up largely surrounded by people who look exactly like him, I can't imagine the effect it must have had the first time he saw a Chinese person; I can totally understand why his mind would start rationalizing this as some humanoid creature that walked out of the sea. I don't think he was ever really about denigrating other races, it was just how his peculiar mind made sense of them.
It's something that's basically impossible for us to conceive now, thanks to the ill-advised cultural melting pot the west has become meaning you're exposed to different cultures and races from an early age, but you can see a similar version of what I'm talking about with how a lot of native Asians still regard black people as some fascinating novelty, (when they're not outright frightened by them).
Late, and not to derail the thread either, but this is basically it.
Make no mistake, Lovecraft was insanely racist, even for the time, but the reason it was so bad with him in particular is because he was so hyperfixated on race, ethnicity, and class that it went from just being the regular accepted thing back then to an absolutely crazy obsession that certainly was not normal, even during the age he was alive.
To put it in perspective, if you asked people back then if they thought whites were better than other races, they would usually say "yes", and leave it at that. Same with asking if rich people were better than poor people. Maybe a little more would say "no", but most would still say "yes", and move on from the subject.
If you asked Lovecraft those same things, he would immediately chimp out, and start ranting, and raving like a madman at you for even daring to ask him that before fervently writing to his friends about how much he hated everyone who wasn't just like what he perceived himself to be (ie; a wealthy, well-bred Anglo), and penning a story about how the Welsh are secretly fish people, or something.
Furthermore, as you stated, the reason he ended up like this is because he did only grow up with people just like him, but it was more than that. He grew up in an extremely sheltered, old-fashioned, aristocratic household with parents who both died in asylums. This all combined with the fact that he was probably also autistic, or had some other kind of similar disorder only made things worse for him.
Now to be fair, this all started to stop when he began to live around other races, and he did actually manage to chill out enough to end up marrying a Jewish woman. However, it never did fully go away, and even by the end of his life, he still held onto some of his prejudices.
Tl;dr: Niggers, kikes, and wagies all lived rent-free in Lovecraft's head which even in a time as racist as the early 20th century was not normal, and this happened because he was in all likelihood an autist raised in an extremely sheltered, and mentally ill household. Once he finally touched grass, he began to lol calm down, but it was never enough to make him fully stop being a /pol/tard.