I really admire you for this. Thank you for doing that. Because my mother made her happiness my responsibility and she never apologised and in fact continues to do this to her kids to this day.
Perfection as a mother is impossible and not required. However a willingness to admit when you were wrong and a willingness to change is important if you don't want to poison your relationship to your child. You admirably rose to the occasion. I wish all parents could be as brave.