score:2
Exit and re-entry at the German border is no problem, as long as the passport is still valid (even on the last day). Note that you need a valid passport at all time while being inside Germany. A minimum validity is not required (ยง 3 Abs. 1 AufenthG).
Please note that you are not allowed to enter other Schengen member states, which would require a passport validity of three months after leaving them (Article 5 para. 1(a)(i) Schengen Border Code). Transit to Germany however is still allowed (para. 4(a)). If you need to transit somewhere else you should check whether you can do so with the passport.