Dear @felise, I agree with Meike. As long as identity is clear, the immigration office has no reason to take away your work permit. If they want to take it away, you can go against this decision.
And as for the appeal in court about the residence permit: I cannot predict the future, but I think your chance is not that bad to win. A german child creates a legal claim of the mother for a residence permit, that's why I think you can argue it is not possible to go back to your home country. But you can dicuss this with your lawyer in detail.
I wish you all the best.