In my experience they don't start off like that, they hide it and sometimes they are genuinely interested in the relationship for the first year or so but once you are committed emotionally financially and possibly with children they feel secure enough to revert back to their default state which is as you describe in your post. You then find yourself stuck with this man child that you love but don't like very much.
I feel there are two distinct groups of men who behave badly in relationships.
One is, as you describe, someone who has played their part well, shown an interest, been attentive, been (or at least appeared to be) good partner/family man material etc who seems to morph beyond recognition during pregnancy and beyond. I think there are a few reasons for this - which have been articulated by different posts already.
But there is a second camp of men who don't hide who they are. Who are proudly X, Y or Z right from the start. Who consider it their 'right' to flirt, cheat, message other women online. There are women who post on here who discovered their new boyfriend is still active on dating apps and some women choose to forgive and move on from it only to find they have continued it and wonder why.
Or men who don't work and aren't independently wealthy, who've claimed that they've had to leave every job because their boss didn't like them.
Who who have a string of 'crazy' exes who won't let them see their children.
Some.women seem more focused on fixing or helping and 'supporting' these men than thinking, "Is this the sort of man I want to be with?"
I read so many threads on here where women post about their 'new' partners - a man they've been on 3 or 4 dates there are things they're not happy with and, rather than walking away, are asking how they can understand, support, deal with various faults. Why?