Yes because family law in America is MASSIVELY sexist against men. Judges routinely screw men over in horribly unjust ways like what you describe. eg "oh you've been betrayed in the worst way possible? Too bad! Now you're stuck being a cuck and you will be saddled with the burden of raising this kid that is not yours. Nothing you can do about it. ha ha ha ha" As for any adoption agency, that child does have a mother. The mother should certainly raise him - and his real father needs to be found and forced to take on the responsibility of caring for the child he created.
Many, many women have gotten hosed, and badly, under so-called "no fault" laws. It's also the children who suffer. Maximum profit for the lawyers lies in making the couple fight over everything.
The original, conservative intent of the law (that all children born during the marriage belong to the married parents regardless of paternity) was to keep children and abandoned spouses off welfare wherever possible, so that the taxpayer is not saddled with someone else's children.
As the country has move closer to socialism, and more women are able to work outside the home, that law as been successfully challenged from time to time due to the other more recent innovation, DNA testing. Conversely, some men who discover it is another man's child and wish to divorce do not want to be denied custody of a child they have loved and raised, and will fight to remain the legal father.