I think you can be driven to an affair.
When everything about your life seems to be OK, everything in the marriage and family life is ticking along and just one thing lacking - sex and intimacy, then it feels incredibly self indulgent to break up a family because you aren't happy.
So you struggle with the need for it, and maybe decide one day to find someone to fill that one gap, so that you can keep the rest of your life as it is, so you don't have to put your children through a divorce and changing their lives.
You tell yourself that it's the easiest way for everyone, because not having the intimacy is breaking you apart.
And so you do, with someone else in the same circumstances, finding something in each other that you don't find in your main relationships but which makes them bearable.
And you know it's no way to live, and it becomes clear its not enough, being happy for a few hours a week.