You’re misremembering how the slavery plot goes, for what it’s worth. In Chamber of Secrets, yes, Dobby is meant to be a sympathetic figure who we’re happy is freed. However, following her pattern of “returning to a plot point that got pushback two books ago to justify it”, in Goblet we learn that Dobby is a little sicko for wanting freedom and payment, and Hermione’s efforts with SPEW (btw that’s slang for vomit in the UK} are consistently portrayed as misguided and naive.
I think it’s incredibly silly to suggest that you can’t make some judgements about an author based on literally a million words that they pulled directly out of their psyche. Another classic example is Joanne’s portrayal of women. If a woman is evil, she’s fat, mannish, and ugly. If a woman is good, she’s motherly and, in the case of Hermione, Luna, and Ginny, not like other girls. Nobody is really saying she was a hateful bigot while writing those books, but the seeds were certainly there.