Yes, the fallout from depression and the events that occur with depression as well as treatment of it are very real. That's no excuse, does give you an understanding of what happened in part. It does not explain the entire situation, however.
The other part that isn't necessarily known, is why during the depression did your spouse reach out to someone outside of their home, outside of their spouse. It usually has to do with something besides the depression. Family of origin issues, poor coping skills, other things in addition to the depression.
When my FWS was depressed, she started talking to other people about how unhappy she was, with me, marriage, family, life, etc. it was during one of her episodes that she ran into her affair partner, who was all too willing to tell her how wonderful she was, how great she was, and as she was being treated for her depression, and was actually improving, with a medication adjustment, this just fueled her sense that I was the problem, and she just started doing whatever felt good, without regard for the consequences.
There was a lot more to the story, however. There were dysfunctional behaviors that went along with her depressed and non-depressed state. There were a lot of family of origin issues, some of which she had never talked about, in our then 9 years of marriage. There was a whole bunch of stuff that she never told me that occurred before we met.
In marital counseling, after the affair was disclosed, the stuff slowly started to come out over the following couple of years. Close
Your mileage may vary, but you are very close to this disclosure. My wife did not begin to actually tell the truth about pretty much anything until six months plus into marital counseling, on our second marriage counselor. We had gone to marital counseling the year that the affair occurred, and absolutely not a single thing came out. She would not even speak to her individual counselors about it. It wasn't until she made a breakthrough with our second marital counseling episode after D-Day, 9 years later, that she started actually telling the truth to her individual counselor as well.
The "Whys" are very hard to get to. My wife didn't even really understand why she had done many of the things she had done. It took her a long time to get to that point.
Good luck with this, I would not trade places with anybody in the first six months after disclosure of an affair to save my life. Been there, done that, I know the hell you are in. Keep working on things, keep understanding it has nothing to do with you, it has nothing to do with your marriage, it has everything to do with the person that you were married to, and their internal demons.