I think the days when you could just set up a company in some random country and run it from Germany are pretty over, the Finanzamt will just treat it as a domestic entity unless you can prove you've gone full nomad.
You have to cleanly separate personal and company taxes. If the managing director makes significant decisions (as in forming the will, not as in executing) while on German soil, the company is taxed like any other German capital company.
Btw. despite the myth, just being 182 days outside of Germany doesn't get you out of German personal taxes. It just stops taxation of foreign-derived income.
If you're talking about income taxation of individuals and would otherwise be dual resident in Germany and another country with which Germany has a typical set of tax treaty residency tiebreakers, then the top criterion in the list is where you have a permanent home available to you. If you have a permanent home available to you in the other country but not in Germany, you are by treaty a tax non-resident of Germany regardless of days in Germany or center of life.
That does raise the question of what does it mean to have a permanent home available to you. And that's a much harder conversation as applied to the edge cases. But one can certainly construct viable enough scenarios where it would not be a close call even if one spends more than half the year in Germany, and then arrange one's reality to genuinely match the constructed scenario. Explaining to the Finanzamt (tax office) might need a Steuerberater (tax advisor) to argue with them, of course.