Doing this is standard practice if you are founding a company. You need to plan for your startup to be actually successful and being on the receiving end of a big exit. You can't just wing it and hope for the best.
Germany has a large amount of wealthy small investors, business owners, family owned businesses, etc. And many of those might retire in places like Spain, Italy, etc. There are ways. You just need to understand the system.
That's not to say that Germany is not a huge PITA when it comes to managing all these constructions, dealing with the bureaucracy, and the maze of silly government agencies that refuse to share even the most basic information with each other so you are stuck in ground hog day providing the same information over and over again (who are you, where do you live, what is your company registration, etc.). But once you know the how this backwards and dysfunctional system works, you can get it to work for you. Because painful as it is, the system does work more or less as advertised. But you do need to familiarize yourself.
BTW. this is a topic where LLMs can be helpful. You can skip a lot of the traditional advisers and other middle men, if you are a bit smart on that front. Using an accountant is actually worth the money for liability reasons. So don't skimp on that. But otherwise, knowing what you are getting into in terms of bureaucratic process can save a lot of time.