I read somewhere that in the western world at least 20% men are raising some other man's kid under the assumption that they are the biological parents.
However, I agree with the idea of "preserving peace". The modern legal system is not based on equality or uncovering the truth, it is based on the principle of upholding the social harmony.
India has similar laws, a child born a second after the marriage is assumed to be the man's biological child and court-ordered paternity test is an exception rather than a rule.
I read somewhere on reddit that during 9/11 a lot of missing person reports were obviously filled immediately after the towers fell. In a bid to fasten up the process of identifying the dead bodies which were unidentified yet, the schools in New York came up with a plan to test the DNA of the kids and parents. This might help in case any parent of the school kids was among the dead. While this helped solve some cases but..... in many cases even after the identity of the victim had been known as the father of the kids (through investigations not relying on DNA testing) after months, the DNA still didn't match the kids DNA. There was a mini scandal in NYC. It was then brought to knees that a lot of kids in Mew York, and many who had their "Father's" killed in New York weren't actually their supposed father's kids after all. Their wives had cheated on them and handed them someone else's baby. This scandal.was OBVIOUSLY hushed down to "not cause any more trauma to the REAL VICTIMS of 9/11". A woman on twitter also tweeted something about this.
And this is very common in North America. I also remember when 23andME were introduced first time in USA. Schools thought it would be very interesting to know the family lineage of their kids and to educate the various ethnic identities of the kids in USA. Well, surprise, surprise, the family lineage of the kids were different from their father's after the results came out. It took some time and finally some women breaking down and admitting to their husbands, that many of the kids the "Father's" thought were theirs, weren't exactly theirs. Their Wives, the ones who had promised "Death do us apart" and all that bullcrap had cheated and were making their husbands raise another man's kid. What do you think happened to that fun little school activity?