Y’know, house elves could’ve been so much better if they’d stuck just a little bit closer to the standard “magical being that cleans your house” folklore.
Like, it isn’t servitude. They move in of their own accord, and if they don’t get any recompense or appreciation, they’ll move out again within a couple of days and knock over your umbrella stand on the way out. You can keep them around by leaving out gifts for them - bowls of cream, thimbles of whiskey, shiny odds and ends - but if you ever pay them in coin, the contract is broken and they’re gone for good. Depending on how shitty you were, you may never get another house elf again (word spreads fast). But if you never pay them in money, they can’t leave; once it’s formed, breaking the contract only works one way, for whatever reason.
So you have these great old families who’ve had a house elf or elves for generations, have skimped on gifts and generally been horrible people, but who are canny enough and quick enough to make sure their house elves never get any coin. It’s part of the contract that the elves are not to be seen or heard unless called for; therefore they must bear witness silently to any atrocities committed in these horrible old places, and are forbidden from negotiating their pay or release. The house elves have tried every trick they know to get paid in coin, but the old families have exactly the same number of tricks to make sure they don’t - because they’re well aware that if this extremely powerful magical being is no longer bound by the contract, their house is going to burn to the ground.
And then there’s Hogwarts, which accumulates a massive number of house elves simply because of its size and the fact that it’s a very interesting place and house elves are curious by nature. They’re recompensed fairly, for the most part, and generally enjoy the work. Students are warned: absolutely do not tip the house elves, you may leave out small gifts but do not give them any money. They are paid in food and drink and shelter. They do not take money.
Enter Hermione, who doesn’t quite grasp how all this works, and she is furious. These poor creatures are indentured servants at best, slaves at worst, and Something Must Be Done. She launches on her righteous campaign to get the house elves paid fairly, in coin, like everybody else, and is so caught up in the perceived correctness of this that she fails to listen when people try to explain that the way it works is already fair and agreed upon. It becomes a story about misguided activism and the fact that you must listen to the people you’re campaigning for before you begin campaigning.
Eventually she does listen, and the house elves tell her that here, for the most part, things are okay; it’s the elves trapped with the rich old skinflints who need help. There are a few house elves at Hogwarts who don’t want to be there anymore, and who have been unable to negotiate a fair release, and so once a month Hermione puts a coin on her bedside table with a very clearly written note that says TIP, with an arrow, and any house elf who wants out contrives to get to that room before their shift is over.
The freeing of Dobby goes about the same, except it’s a coin Harry slips into the book instead of a sock. Dobby then joins Hermione’s activism from a place of intimate knowledge of where the system is most broken; he is of the opinion that the contract should be breakable both ways - it isn’t fair that only the masters can break it, house elves should be able to leave any time, for any reason, even if they’re being paid correctly. Most house elves think he’s nuts for trying to break with tradition like this but… something something metaphor for unionization, something something.
I think that could’ve been neat.