Wouldn't such a restriction be an infringement of a fundamental right of both the doctor and the patient?
The logic behind the law is the same logic that makes it illegal for adult schoolteacher to sleep with a pupil, even if she wants to.
The Doctor is an authority figure. It is too easy for him to 'mold' your opinions and desires for his own benefit. Add to that the helplessness of needing medical or psychiatric care that often causes patients to idolize their doctor, it becomes a loose/loose situation. You cannot trust your feelings for him. But it is darned hard not to trust your own feelings, so hard that society steps in and makes a law. Once you are up and healthy you can seek out the guy to see if he is really all that.
But until then he is off limits for you just as you are off limits for him. Should you succed in seducing him he stands to get fired from his job.
I think you are right and it is infringement of rights but it should be valid advice because a doctor needs to be emotionally detached from a patient to provide the best care using statistics and science. So I think it is a smart idea but I don't think that is enough for it to become a rule because it is impossible to stand in the way of love.