The answer to the question that interests you can be given from different positions: theoretical and practical. Let’s start with the theory.
From the point of view of psychoanalysis, the basis of the development of the psyche is sexuality. Before becoming mature, child sexuality goes through several stages of pregenital development from the birth of a child to its exit from puberty.
The success of each stage depends on many factors, including the behavior of the parents towards the child at each of the selected stages.
Thus, in the period from 3 to 6 years, the child enters the phallic phase of his development, where he is actively interested in his own sexual organs, notices the difference between boys and girls and, in connection with new discoveries for himself, receives new experiences regarding himself and his role. Boys, for example, are experiencing an Oedipus complex during this period.
Unconsciously, they are attracted to the mother and also unconsciously seek to take the place of the father next to her. The father figure can temporarily be perceived as interfering and punishing.
For a harmonious psychosexual formation, the boy’s ultimate goal at this stage is to accept the inaccessibility of the mother as a sexual object. This process includes mourning over the impossibility of eternal merging with it and identification with the father, in the image and likeness of which he once will build his own family.
The parental position at this stage should not be overly rejecting, nor overly stimulating.
Any contact of a child at this age with a naked mother will be for him a stimulating and reinforcing fantasy, which he must give up. In other words, the lack of boundaries can lead to a “stuck” child at the phallic stage of development with a high probability of the formation of neurotic symptoms.
From a practical point of view, I noticed that the feeling of awkwardness that you feel when your son sees you naked indicates a need for you today to draw the line between himself and him. Just for some reason, the mere argument that you are uncomfortable and unpleasant is not enough to take action. Today it is a fairly common story, when a practical answer is present in the intuitive feeling of the situation by the parents themselves, but in order to use it, you need a confirmatory voice of a specialist.
So, perhaps, it is worth resolving the issue with the lock on the bathroom door. And you will be calmer.