It`s a funny old game !!
I have a branch where a male was born illegitimately (in England), early 1800s and baptised with the mother`s surname, although both parents were named.
The parents eventually married but the child continued to use his mother`s surname, which continues to this day