Because that’s how the body has developed (and evolved). Here is an image that depicts male genital development. The cells of the urogenital sinus go on to develop into the urethra and bladder, while the ureteric bud becomes the ureters that connect to the kidneys.
Frequently, when evolution arrives at a successful mechanism for achieving a certain result, subsequent changes are infrequent. For example, individuals born with genital malformations (like hypospadias) have a hard time reproducing, or get recurrent infections and die. One can view those as evolutionary “attempts” to alter the basic structure of the penis, for better or, in this case, worse. In summary, natural selection has led us down this path.