The words sound the same, but they're derived from different sources. The racial slur appears to be derived from the word "barracoon", and was in use as early as 1837. Barracoon is a bastardization of the word "barraca", which is a Catalan word for the temporary pens used to hold slaves prior to their transport.
The origin of "coonass" is a lot less distinct; there are multiple possible etymological origins of the word, and only one of them has anything to do with the ethnic slur "coon". Coonass certainly isn't recognized as a universal racial slur the way "coon" is. Though the Lousiana state legislature passed a resolution condemning the word, and some Cajuns do consider is a slur, a lot don't; I served in the Army with guys from Louisiana who said it proudly. And I sincerely doubt that the origin of "coonass" has anything to do with the racial slur. If you consider what society was like in 19th-20th century Louisiana, you'd have to believe that no white person would use a slur like that to refer to another white person; even the lowest rung of white society would have still been considered part of society; a slave wasn't. I certainly believe that in the Louisiana of the 1800's (both pre and post Civil War), calling a white person by a racial slur reserved for slaves, no matter how low the status of the white person, would have been unthinkable., so I doubt if people in Louisiana were calling each other "coon" in the same way they referred to slaves.
I encountered this sort of word when I was a cop, in the use of the term "white trash". It was either a slur or a mark of pride, depending on who was saying it. Usually it was broken down by economic status; if you were in the burbs or city, it was an insult. If you lived out in the holler, it was a badge of pride. I think that's pretty much the way that "coonass" is used. That's different than the way the racial slur "coon" is used; that term is pretty universally reviled. Even Black people never tried to adopt that word and take its power away, the way they did in some ways with the N word.
I looked this stuff up because the origins of words and language is interesting. But it is true that language is constantly evolving, and the original meaning of words can change. People hear the word "coon" now and they freak out, even though the use of the word may have nothing to do with a racial slur (though it's considered by some, both Cajun and non Cajun, to be an ethnic slur). That sort of societal freak out can begin to alter a language.