The old laws just do not acknowledge the new genetic technology. They were written in an age when you really could not know who the father was. In many cases, the laws stated that if a man is married to a woman, he is legally the father of her children irrespective whether he is actually the father.
Quite so. In fact it might do the institution of marriage a lot of good if we had laws which relieved the husband of any liability for the upkeep of children he did not father and imposed liability on the mother if she failed to identify the biological father. Under such circumstances it would become routine to genetically test for paternity thus establishing beyond doubt the father and avoiding the situation where the husband becomes the victim of fraud because of the infidelity of the wife.
You are correct about the law being written for a different time. I suspect that the statute at issue in this case was enacted in response to that problem. Blindly following that kind of law, when the rationale behind it no longer applies is intellectually lazy, at best.