Addressing your own fears is likely to be v helpful here too - there's a great book for this called When Your Kids Push Your Buttons. Be warned doing the exercises properly will make you pretty raw emotionally but it really helped me to process some things.
After an unhealthy relationship ends it is extremely common to fear that your DC will turn out like your ex partner, especially when they are the same sex as him/her. Do be reassured this is a TOTALLY normal and understandable fear. You think about how your ex was and the last thing you want is for your own child to grow up like that, so the minute you see similar behaviour, you go right to that fear outcome, "He's going to grow up just like him. He'll never respect women." (Or whatever the belief is). In addition, if you've suffered abuse (even "just" emotional abuse), you are still processing and healing from this trauma and any hint of something similar can trigger a trauma response. These two issues interact and cause us to react emotionally which is then getting in the way of us actually dealing with the issue and being a strong, calm role model, which is what they actually need us to be.
Parenting is complicated and none of this happens in a vacuum. :) It is easy to say "Well of course you need to give boundaries" but you may need some support with how those boundaries look and how to get there.
Your DS probably has learned to some extent to use you as an emotional punchbag if he's seen his father doing it. However, this is NOT a given outcome which is fixed and you can't change. He is ten, not twenty. You have time and he has time to learn a new way of relating to people. You've done the first step which is to say very clearly to your ex (and therefore, to your son) this is not acceptable to me, I don't allow people to treat me in this way.
Secondly, it is easy to look at childish behaviours, immature responses which mimic your ex's behaviour and feel afraid that the child is copying the adult's example, when in reality you are seeing everything through this lens and sometimes it is the other way around - a child is acting in a perfectly ordinary, childish, immature way because they are not mature enough to act like an adult. It was the adult (ex) in their use of these behaviours who was acting like a child, not the other way around.
BTW you may want to get this moved to Relationships or Parenting or you'll continually get people coming on to leave single comments who have not read the rest of the thread.