I had the same thing happen. Before my current wife (who’ve I been with 7 years now) I got married to a girl I knew I should have broke up with. Our relationship was heavily toxic and all the warning signs were there. My best friends and even family tried to convince me to follow my gut and just have us split before the wedding. She ended up leaving while I was deployed overseas and it wrecked me. However, like you, I learned and do not regret the experience now. Both of us are now in healthier places and made amends for the toxicity we both brought into each others lives.