I don't know what the timeline is, but it's not uncommon for post-bypass patients who can no longer "self-medicate" by overeating to develop other addictive behaviors -- the prescription med abuse and/or affair may fall into that category.
Now, I'm not advancing that theory as an "excuse". Her current behavior is still disrespectful to your marriage, and you shouldn't have to accept it. But it may help you with your compassion to consider all the possible complications of her situation.
"Show me a completely smooth operation and I'll show you someone who's covering mistakes. Real boats rock." -- Frank Herbert