If you just want to move out of the country you can also just keep the ownership of the company within the country. You do this by putting your shares into a holding that stays in Germany even when you move out. That holding needs to be managed within Germany, so you need to assign a friend or be in Germany twice a year to sign off on having done the management within Germany.
You do need a bit more expensive tax advisor, but it's not that difficult. There's a description here: https://www.juhn.com/fachwissen/internationales-steuerrecht/... (3.1.)
Of course, if you want to move the company out of the country, you'll need to pay taxes on any value increase the company had. As others have described this is pretty reasonable though - you get taxed exactly as if gains were realized. This is tax you would have had to pay some time in the future anyways, except by moving to a tax-evasion country.
The only unreasonable part of the law is how they can assume your valuation based on earnings, but that only applies if you can't provide a valuation based on German standards.