There isn't anything here that anyone outside INZ will be able to tell you about your situation. We are members of the public, not anything official.
To sort out your situation, you need to contact INZ. For one thing, the helpline should be able to tell you what your situation is regarding the visitor's visa. For another, you should tell the CO (contacting him/her direct) dealing with your Residence application that you have received the requirement for the doctor's letter, and/but that you will have to get your passport back from INZ (the other department) before you can obtain the letter. It's always important to respond by any deadline given you, even if you can't meet the requirement by that date. INZ are usually reasonable about waiting, if you let them know what is going on and that you're doing your best to do what you have been asked.