Well Sci Fi is a huge genre obviously, so it depends. However, a fair amount of sci fi is more critical of its world building implications. You can have dystopia in sci fi, and in a way that critiques real world dynamics. Whereas when you translate this to fantasy, you get something like a grimdark aesthetic, one that is often, imo, unintentionally and unwittingly very campy (basically, edgelord, the setting. See: Lamentations of the Flame Princess. On the other hand, a game like Mork Borg leans into the camp to produce something that is both very dark but also very funny).You are making sense! And this is very much true. I'm going through Robert E. Howards books right now, and the use of certain words coupled with a whole timeline and theory about how certain cultures evolved from and back into apes, on a map that's meant to be old earth, is very unsettling.
But let me ask, how is science-fiction really better at this? Isn't it almost a staple of science-fiction of having alien species have hugely different capacities from us? Being way more intelligent and advanced in technology? Being physical strong or frail, forcing us to adapt in case of conflict? Communicating in ways beyond or comprehension? Not being able to breath air with oxygen?
My guess (and it really is a guess) as to why that doesn't feel icky is because its absolutely clear that this is a different species. They come from a different planet. And you know what, if real aliens showed up tomorrow, I'm willing to bet a good sum that some ideologists would absolutely turn their presence as some justification to be racist and divide people.
Just like the observation of different species like gorillas, chimpanzees, and non-primates was used in the worst way possible to fuel racial theories.
5e has the problem of being fairly whimsical and non serious in its tone and artwork, but then all of a sudden mentioning that your drow or tiefling character should face hatred and discrimination. In games I've been in there's been at most a very light gesture toward that kind of racism that we don't follow through on because it doesn't fit well with the 5e tone overall. Whereas I think in a different genre (Sci Fi for example), and with the right group of people, a rpg can really explore anything from those kind of social dynamics to full dystopia in an interesting and non-problematic way