P.M.
Your daughter is trying to meet her own emotional needs in the only way that occurs to her. It's not easy for a child to have a new baby in the family, and if you were expressing great eagerness, or anxiety, during the pregnancy, or were sick a lot and less available for your daughter, she was almost certainly feeling anxious about her status in the family.
After a baby arrives, older siblings are often feeling left out, or like a third thumb, unloved, confused and angry. Potty regression is extremely common under those conditions. She needs you, your attention, your time, your cuddles, and in her immature mind, the way to get those needs met is to be more like that new baby, incapable of bodily control. Even if it makes you mad and earns her punishment, that's still attention.
Your daughter sees your anger as a confirmation of her fears that you don't love her as much, and she's simultaneously punishing you for giving so much of your time and attention to that baby. It all makes perfect emotional sense to the jealous sibling.
A couple of moms I know made extra efforts to find one-on-one time, and include the older child in everything, helping with the baby, helping in the kitchen, so they would see themselves as useful and valued contributors to family life. Make a point of noticing a dozen positive things every day: "You brought me my shoes, sweetie! Thank you!" or, "I love those colors you picked out to wear today." or, "I see a young lady who is sitting up straight at the table!" or, "Do you know how much I appreciate your sweet voice?" or, "I feel so happy when you laugh like that!"
Noticing the positive will have her wanting and working for more. Not punishing for the negative, though it seems like it would only make things worse, may actually help, once you understand the child's internal processes. One mom I know offered to let her child wear diapers again, and the little girl took her up on it for a couple of weeks, then decided she liked being trained better. But the acceptance from Mommy apparently helped. No more accidents.