I give you lots of credit for trying to break this pattern of mother-behavior. Your baby deserves better. You deserve to have the kind of relationship with your child that you missed as a daughter.
I worry that your mom has convinced you that you are responsible for making her unhappy and therefore you are responsible for making her happy again. You’re not. You can’t anyway. She sounds like one of those people who is happily unhappy. Take away her unhappiness and she is miserable. She needs treatment from a qualified therapist, not groveling from her daughter. You can’t change her (or your grandmother) and it’s way past time for you to stop trying.
There’s no need for you to act the way she does to put some healthy distance between you. Let her know that you absolutely do want her in your life but that you aren’t going to stick around if she is hurtful. Just quietly leave any time she starts in on you. Cut back on visits and keep them short.
Please don’t feel guilty about making a nice connection with your stepmom. I hope she offers you some of the support and affection that your own mother can’t. If so, consider it a gift. You have been given another chance to have a mother-figure in your life.
I hope you and your husband will consider getting some couples counseling while your motivation is high. A counselor can help the two of you learn how to draw healthy boundaries around your own family and how to support each other if you find yourself slipping into your mother’s patterns. You are young enough that you can learn how to catch yourself and how to do things differently. You have a lifetime of being a wife and mother ahead. It’s definitely worth putting in the time now to become the kind of person you want to be.
I wish you well.