I agree that preventing a person to choose to sell something they own is a restriction on their freedom. But problems arise when the negotiation of that exchange is unilateral, relegated to EULAs and contracts which are incomprehensible, non-negotiable, and mandatory to purchase the product, and performed in a less-than-perfectly-efficient market.
It would be one thing if I could buy a Tesla, a Nest, or log onto a site with ads, and the process included a step where I could elect to share my data, to not share my data, or to give them the data and promise not to ask for it back, with different price points for each.
It's another thing when giving people the freedom to give up certain rights results in all manufacturers requiring people to exercise that freedom in order to purchase products.
The market is far from efficient. There is no car that's just like a Tesla but costs more by the value of this data exchange. There is no negotiation of the contract with Tesla, it's built into the purchase price and required by the legal department.
Observing that the market is pervasively inefficient in a way that leads to a bad outcome, and devising regulations that correct the inefficiency, is precisely why we have laws and governments.
In prior times, such covenants were also used to try to racially segregate property, by forbidding sale to a person of a race the covenant's creator disliked (such covenants are technically still valid, but unenforceable by US courts).
And they're sometimes used for other things, too; I recall there was a house near my college's campus that the college wanted to purchase and use, but the owner had set up a restrictive covenant that would forbid any later purchaser/inheritor from selling it to the college.
Classic work-for-hire includes ghostwritten novels and autobiographies, corporate reports, web pages, and most likely every line of code you've ever written while employed by a corporation.
There are jurisdictions where moral rights cannot be sold, and others where they can, but work-for-hire nearly always sidesteps the issue.