It’s simply the law, domestic and international. Look it up. The legal determination was established to put an end to just this type of problem with determining parentages in an era where there was no such thing as DNA testing. Now that DNA testing is available, the principle of using the legal father and mother to determine citizenship remains in effect under the principle that the legal parents having the custody of the child are responsible for determining the allegiance of the child, and citizenship was originally all about allegiance and loyalty.