Whenever we feel we cannot be happy or healthy without another person in our lives, the chances for codependency to be already there are very high. If we find ourselves unable to feel good, fulfilled, strong without a person's support, then it could point at codependency attachment to such person. In counseling and psychotherapy we naturally develop attachment to those who support us, but when instead of such experience being empowering, healing and liberating, it becomes a dependency on that other person's physical or emotional closeness for us to be and feel fine, to cope and do take good care of our lives, then that would be codependency.
It seems the Dr. has taken the main authority role in your psyche, like a father who has the power to help and discipline you. On the other hand P seems to be a more emotionally close person to you, more empathic and understanding even more because of how much you have shred with him about your experiences.
In order to prevent developing sexual attachment to a professional, you need to be open and honest C. Remember those are core requirements for psychotherapy to grow and be truly beneficial for you. All sensible areas including the sexual one, should be discussed, even more if they arise during therapy and challenge you. In this way you would be preventing developing something that would undermine the very support you get from it.
I truly believe that the process you got in last session was very good and never a wrong ting at all. This sis what you need to do in psychotherapy work C. Controlling yourself, faking positive feelings, avoiding pain in therapy would be the worst approach. Since therapy is about the opposite of that. That's why you get a professional to facilitate and support such venting process, offering a healing container. Repression and avoidance are not compatible with effective therapy. I am glad you were able to do this C. "Staying in control" in therapy equals undermining it and its potential for healing.
As a person and professional caring about my life and the impact it has on my loved ones and clients, I am always working on myself to identify and eliminate unhealthy patterns, including any codependent trait that could appear in challenging times.
When I notice a client of mine getting sexually attracted to e, I address the situation in a professional and therapeutic way, since it should be used as a way to explore the client's personal-relationships issues, expectations, patterns and more. So it should become an integral aspect to work on the client's therapeutic process. I remind client about boundaries and limits in therapy, about dual relationships and what could undermine therapy if not handled in professional ways.
In case a therapist develops feelings or feels attracted -experience counter transference, he-she must get support from consulting with more experienced professionals about the case in order to make necessary adjustments. If necessary professional would have to look for counseling or psychotherapy him-herself, and if necessary refer client to another clinician if unable to play a professional and ethical role. This is what I do too.