Thank you for reaching out to us.
I think in the meantime we answered a part of your question (esp. about travelling with a residence permit according to section 25 (5)) already this comment section, right? And yes! You are allowed to work!
I am not a lawyer, but the procedure of the immigration office in your case sounds not bad to me. I am not sure whether an appeal based on the argument of coming from the Netherlands to Germany because of medical needs will help here.
Do you agree dear @mbeon-fardeen?
In any case, please also don't hesitate to get back to us with any further questions.
All the best,