Psychologically speaking, it's often because of people feeling insecure about themselves and thinking they deserve the bad treatment. They fell in love and see it as a good thing that their love is reciprocated - the bad treatment that comes afterwards is seen by them as a sort of punishment, meaning that they don't see the person they're in a relationship doing anything wrong by treating them badly, but rather think that they did something wrong and it's their own fault.
It's destructive for sure but they would rather live in a relationship that they remember made them happy when it started than lose the person they care so much for. Even when you tell them it's not their fault that they're being mistreated, they'll still think that they're the ones that need to improve, not their significant other.