Hey, just tossing in a comment to say that what you did, to me, sounds completely human. You were in the process of letting go of a longterm, profound relationship -- a marriage. Healing from something like that takes time. I've heard it can take as long to release a relationship as to build it.
It takes time to gradually get "unconnected" from such an intense bond. It would be so human to express the remaining connection, in the way you used to expressing it with your wife.
To me it sounds like the trouble isn't something wrong with you at all, it's just that you formed a new relationship before you'd fully let go of the old one. Also, so very human.
Once the new relationship started, you had two partner-type relationships going. Near impossible to maintain integrity in that kind of situation, but you clearly do have integrity -- clearly lying isn't something you could live with. So you came clean, and now you've got the consequences which are so hard.
Ending a marriage relationship requires so much healing. No matter who ends it, you each need time to heal and to gradually finish letting go. Be gentle with yourself. People who are wounded from divorce tend to be so full of conflicting needs & emotions & torn up pieces. You can't expect yourself after a divorce, to be operating with complete balance. You're bound to make mistakes that you wouldn't otherwise, and find yourself in messes that you wouldn't otherwise -- just goes along with being so impacted from a divorce.
Take care. I'm just stopping by so if you answer & I don't, don't take it personal. I wish you well, hang in there, it'll get better. Just takes time.