The n-word is the modern legacy of a history of 400 years of racism and enslavement. Its modern usage originates from using the word to reinforce the same economic and social oppression. That context exists for the n-word beyond your 'baseline' racial epithet.
'Hacker' is different because it's a term that originated with a somewhat positive connotation within and by a community, and got misinterpreted negatively later by the outside.
Yes, the duality in assigning meaning to 'hacker' internally/externally does share some similarity with a group/race-based slur that has been 're-claimed', but obviously not entirely. The n-word seems like a particularly bad choice of example, though.