Yes, provided that you have adequate funds, you can apply for a residency permit and spend your retirement in Germany. Moving to UK from Germany after Brexit or vice versa isn't impossible.