Vertebrate embryos are, prior to a specific stage of development, all female.  After that stage, timing of which varies by species, some embryos develop into males (about 50% in humans).  In some fish (wrasses, for example), that stage is not reached until well after hatching and maturing--indeed after having lived and reproduced as females.

So if a young wrasse were capable of formulating such absurd imaginary nonsense of being "a male trapped inside a female's body" as some dysfunctional humans do, its mother could simply reassure it, "Don't worry dear, you'll be one soon enough."

But without surgery or prostheses.