I've worked with two people whose spouses were terminally ill (one male, one female).
Both had affairs. Whether those affairs were consummated is none of my business, but they were certainly emotionally intense to a point which, in other circumstances, would have been marriage-threatening. In the case where I knew both parties to the marriage, I know for a fact that the sick husband knew and tacitly approved. In the other case I strongly suspect that was the case.
In each case, the emotional pressure of seeing their spouse die was insurmountable. They couldn't talk about it to their children, because they were watching a parent die or, in one case, screeching down the phone from Australia that the healthy spouse wasn't upset enough, when in fact she was maintaining her composure to actually deal with the reality rather than emoting from 6000 miles away.
They couldn't talk about it to their extended family because they too were too emotionally involved.
One of them told me that their experience from support groups and campaigning organisations was that virtually everyone caring for a spouse with this particular, aggressive and essentially untreatable, cancer had formed a relationship outside the marriage and that was what allowed them to continue caring.
It might be self-serving. They might, of course, be using the 24 x 7 grind of having a dying spouse as a cover for the affair that they always wanted, although that does seem unlikely. But for children to then, afterwards, start on about loyalty seems unnecessarily judgemental. Watching a spouse die must be one of the hardest things someone can do. Expecting them to be saints at the same time seems harsh.