In Scotland but a long time ago, I got a scrappy bit of paper that specified the sex, weight etc. of my baby, which was taken along to register the birth. Definitely didn't have to have a doctor's anything, a midwife would do. There are people who have unaccompanied home births, so the paper can't be obligatory, but I could believe it might cause some hassle not to have it. I think I've read that in that case you make sure to take the baby with you to register the birth, but I think the point is to prove that there is a baby. Whether anyone checks the sex, I don't know.