That's what I feel is so difficult about writing around the Annie Arc. David acts like he no longer loves Maddie, and I think that lack of feeling stays with him throughout the rest of the series. The way I am dealing with it is by writing that he's been so hurt by her that the only way he can handle still having to be around her, is to act mean and spiteful. I think the fact that he is mean does show that he's still in love with her deep down.
Maybe it's being mean and spiteful towards Maddie that makes him overlook how wrong it is that he's sleeping with her married cousin.
I know most of us, myself included, think it is out-of-character for David to be okay with sleeping with a married woman, but in my story I can't change that he does that because my goal is to not alter the original series. So, the sad truth is he does sleep with a married woman, and he seems very content in doing so for a couple of weeks at least. I think it's also out-of-character for him to be so mean and nasty to Maddie. I think he's just so broken at this point in time. I mean, the baby was lost only 6 months ago, and he's been in this downward spiral of slowly losing Maddie all that time. Plus, and this is only something I made up for my stories, his best friend Benny has recently been admitted to rehab for being an alcoholic. Benny was the guy David would hang out with at the bar on the weekends and was part of his bowling league. So, between losing Maddie and Benny, David's pretty much lost his support system, making him ripe for someone like "bored housewife" Annie to come along.