I don’t know how that could work in certain situations. Like a condo where the HOA does exterior maintenance on the roof and siding. Or a neighborhood where the HOA maintains the retention pond.
What's necessary is to limit the power and scope of HoAs. In Canada, for example, HoAs are generally restricted in how they can levy fines - so their ability to mess up your life is greatly reduced.
Well in the US we used to be forced to agree that no "non-whites" would reside at the property when we purchase it. Later SCOTUS would state such provisions are legal between private parties, but can't be enforced with the coercion of the government.