I'm sorry that you are dealing with this situation.
There are a couple of things to consider here. You said the abuse from your doctor started a few months ago. Then you mention "everytime" you go back, this happens. You are seeing a doctor quite frequently then? Most office visits do not require full undress, so is your condition serious to require so many visits in just a few months time?
You are old enough to know that that is not supposed to happen. Yet you are putting yourself in the same situation. I would bet that if you questioned this doctor just once, he would back off. So, that makes me think that you are confused about your feelings here, and maybe he is confused about your participation in the odd examination. Could you be sending the signal that it's ok? For a man to let another rub himself on him, without a WTF? happening, then you might un-intentionally sending the signal to the doctor by returning, and allowing him to continue, that you don't mind it. I'm sorry, but that is how it does appear.
Abuse is not ok. Regardless of sexuality and feelings two people have for each other, fondling and that type of behavior is not ok in a physicians office. If you want to get justice, you can get some sort of "nanny cam" type thing and get the abuse on tape, however, unless you are telling him to stop, or atleast moving away, then it would appear you are encouraging him, and although not moral behavior, and against code of ethics, the doctor could turn things around in court.
I think the solution would be to just find a new doctor.