The general rule is simple: call people by the names they wish to be called by, using the pronunciation they wish you to use... as best you can.
Courtesy consists of respecting others' wishes. It is not appropriate to tell someone that what they wish is wrong. And it is not appropriate to tell someone they don't have a right to their preferences.
As to whether someone who doesn't do this is being racist, it is hard to know what is in somebody's heart, so the racists can often get away with it.
If you call someone by a name or pronunciation that you know irritates them, then you are being irritating.
By the way, the same principle applies to things like nicknames, or titles, or category names.
On the reverse side, if your name seems unusual to other people, then you are going to have to accept the fact that they will get it wrong and you may need to spent more effort spelling your name, etc.
There has been some news media coverage about this in recent years here in the US, most of it seeming to center around middle eastern and south Asian people whose names may be genuinely difficult for native English monoglots to pronounce. The coverage that takes this tack is mostly in the left-aligned portion of the online press and I assume this generates a fair amount of clicks for them.
My workplace environment is very international. I have significant numbers of colleagues from India, China, Europe, and the Levant. We all cheerfully mispronounce each others names a little bit, because it's hard for most Americans to say 'Satyanaryana' or for many of my Chinese colleagues to say 'Roberto Lopez'.
Deliberately mispronouncing names can aggressively rude, motivated by xenophobia, racist, etc. But anglicizing names (or italianizing them, etc) is a pretty normal practice and not motivated by anything negative.
A strange thing I've gotten used to as the number of immigrants employed here in America has grown over my lifetime is having to spell my extremely common English name. This would never have happened 30 years ago but it's fairly common now. I was irritated by this for a while, but I never assumed it was due to any animus from the immigrant I was speaking to.
In my opinion, it's forgivable if people would mispronounce my name but if they would do it for fun or on purpose several times then I would think they're being mean/rude.
My last name Zialcita can be pronounced as (ZEEAL-SI-TUH) or (SHALL-SI-TUH) but my fellow Filipinos could not pronounce my last name correctly and I forgive them for that because I have a foreign last name.
I don't think anyone would be able to pronounce a foreign name correctly like right away unless that person has a neutral accent or could pick up the pronunciation quickly. You would know if someone is deliberately being rude by the tone of their voice or their manner of addressing a person's name
Americans, most especially the left like to get offended easily and accuse others of being racist and not even giving the person the benefit of the doubt. A respectful person or someone who could pronounce names correctly could be racist at heart so it's unfair to point a finger at someone and label someone as racist all because of mispronouncing a name. Racism could be covert or overt so a person could be inept if they would just base racism on (un)intentional actions