The author invested a lot of effort into creating a context where slavery could be justified. She even created a whole subplot for the express purpose of painting people who want to end slavery as misguided.
the entire plot line about dobby is that he's extremely strange for a house elf. there is not a single other example of an elf like him in any of the books and every single other house elf admonish him for wanting to be free.