When you were in utero did you have the precursor to a penis or a vagina? It seems we all had BOTH, and depending upon the level of sexual hormones one will develop and the other will fade away (mullarian and wolfarian ducts for those of you in Rio Linda).
The first sexually reproducing organisms were hermaphroditic, so the penis and vagina obviously evolved in parallel.