Having been with someone before that had severe psychological issues, sometimes the only functional comfort is someone else. It's not personal, it's at best a momentary escape from high levels of stress and pain with a side-serving of personal affections.
Also having been the someone else for someone who was dealing with a long-term partner going thru a lengthy and rocky process of treatment for extreme issues with psychological difficulties (due to drugs) I can attest that when the other partner seeks out attentions from outside the relationship calling it "sex", it's very rarely the intercourse they need, it's the afterglow. It's someone to listen and lie and tell them everything will be alright.
Dealing with someone else's demons is a special level of hell, double so when it's the demons of someone else you share deep feelings for.
Durring such; a lot of people end up reaching out for that outside support, and usually it can have very painful consiquences for the partners going thru the struggle. So I would advise against such actions on either side of the equation. But see and address what the behavior actually is a symptom of.