And now I probably scared away everyone who thought I was such a caring, compassionate, good-hearted person.
No, you didnt't!
You did what you thought was right, in the context of the marriage. Dan chose to take it outside the M, and things went downhill from there. Don't beat yourself up, you were not the one at fault. You had two strikes against you, from the start, I think. First, your Mom's attitude set you up, and then your age when you started dating Dan. You didn't have anywhere to go for guidance, so you followed your heart.
I don't think you laid the foundations for his problems, it sounds like they were laid before you got there. You got caught in it, with no way to really know what had happened.