I know in my own marriage I stayed in it to provide my son with what I thought was a stable background and to give him what I thought was the family life a child should have with two parents. But that isn't always the best way and it took me taking my son to therapy after the divorce to really see it.
We are long before we are convinced that happiness is never to be found and each believes it possessed by others to keep alive the hope of obtaining it for himself.