Without denying
at all that racism exists, I believe it is also possible to imitate accents outside racism. I'm from the south of France, and my accent kicks in when I speak with elderly family members that themselves always have the southern accent when they speak. Despite that, sometimes I make jokes imitating the southern accent, does that make me a "self-racist"?
Clarification in case it's needed: I absolutely agree that making fun of someone's accent when they come to you is a best inappropriate, and more often than not utter bigotry. But I'm concerned about criminalising humour. This might not be a widely-shared idea (especially in the anglosaxon world?), but I even believe that racist jokes can be tools against racism, decredibilising racism and not actually oppressing the minority in question. Of course, again, context matters.
(clarification #2: I don't believe "cancel culture" is a thing, if you do racist jokes in the public sphere and someone calls you out for saying something racist, I don't believe anyone has been "cancelled")