If you're aiming for a normal exit - where you actually sell the company - things are much more favorable.
You need to set up a holding company, which is usually a UG. This is easy and cheap: there is a simplified process for it ("Musterprotokoll"), and it requires no upfront capital like a GmbH. As of recently, it can be done online without having to visit a notary in person. The overhead is negligible.
Once the holding sells its subsidiary ("share deal"), in most cases, the effective tax rate at the holding level is only ~5% due to § 8b KStG. This is not bad at all, since you'll want to reinvest most of the money anyways.
There are gotchas in every jurisdiction, and you need to get professional advice by a local accountant. Germany is a fine place to run a business. If you already live here and don't want to move your family for tax reasons, you don't have to.