Feeling stupid for allowing myself to give a guy a chance over and over

I’m really beating myself up over this. I know this guy isn’t good for me and we aren’t a match. He’s disrespected me multiple times. We didn’t see each other for 3 months, he randomly reached out, I agreed to talk and of course It went no where and It was the same toxic cycle. I’m fully aware that it’s no good but I still allow It. How do I stop beating myself up about It? I think I’m finally done with him but mad at myself for even allowing that door to open again. Thanks!