My dad worked in M&A for a long time and handled the sale of a plastic molding company where the owner was getting quite old and couldn't really run the business anymore. The company was extremely well established and had a very strong and loyal customer base and ran off a single manufacturing facility in a small town out in the boonies. The owner certainly wanted a fair value for the company but he also strongly desired that the plant be kept open and employees retain their positions. Adding this sort of a restriction on a company you're selling is possible - but it is hellishly expensive, generally you're considering adding some sort of third party oversight and auditing for all HR actions and business decisions. If you buy a company under these terms you can end up utterly destroying the company if supply chains shift - the local labour pool is unsustainable or a plethora of other reasons... And almost certainly this burden is mandatorily bundled with the company - so once you've rode the company value down a bit and are looking to get out all of the buyers will know how much of an impossible situation that company is in.
At the end of the day when you sell a company you are divorcing yourself from the future direction - you might be invited to stay on as an executive - and the new owners might listen to you... or they might not - that's entirely up to them. Any promises or commitments you've made as an executive are only as good as your word - and when you sell your company your word stops having any power (because you sold that power).
I would never shame someone who wanted to keep an ideal going from making an exit they personally need to make - always prioritize your health and happiness over any venture - but when you sell you're accepting the fact that at any moment the buyer may completely reverse the direction of the company.