Hi LD, I didn't read the whole thread, just your initial post and the first few, so apologies if this is repetitive.
I think that you are looking for an immediate positive response from your daughter, whether it's events (LD: "let's go to the park!" DD: "no, I hate the park!"), or objects (LD: "would a new toy make you happy?" DD: "yes! gimme that! I mean no, you are terrible!" or "let's have pizza for dinner, last night we had pizza and you were happy." DD: "no! I hate pizza!") or interactions with you (LD: "come sit on my lap and snuggle." DD: "no! I don't like you!"). She's probably learned that if doesn't respond in the way that you want, you will keep offering and keep offering, looking for that positive response from her. That's what you call spoiling. What she has learned is that she has lots of power. That's what kids are built to figure out and it's normal - where do I have agency? Where do I have control? Where do I not have control? Kids should have a reasonable amount of autonomy and power and self expression based on their ages. You are giving her too much power over your interactions with her and over your emotional response.
Does this remind you of interactions from you past? Didn't you have this dynamic with your mother? Over and over, you made the effort to make your mother happy and it never worked. You tried and tried and tried and then gave up, hopeless. And does it remind you of the interactions with the AP? No matter what you did, you made him happy, or at least he pretended to be happy, because then he got what he wanted (sex, and his own ego stroking). It must have felt like an incredible relief to you. In your head you were a bad mother, bad wife, bad teacher, unattractive woman, bad person, but here was this one place where you got instant positive feedback, constantly, every time you looked for it. The relief from the relentless internal attacks that you perpetrate on yourself is addictive.
Back to your daughter. You are BUILT to look for positive feedback, not get it, and keep trying until you give up and feel hopeless. Your mother did that to you. Those neural pathways are deep grooves for you and it all feels very real, like if you get a negative response from DD you really are a bad mother and your world is unsafe. How do you interrupt this pattern?
When you are calm, make a list of what it looks like to be a good mother. A good mother is interested in what her child is interested in. A good mother provides a stable and predictable structure. A good mother allows her child to express her feelings and experience and validates them. Etc. It might take you a while to write it all out, and you could get feedback from people you trust. It's probably a good exercise for you to do.
Then, the next time she has a temper tantrum, and you feel like a terrible mother, go into another room, use your calming/cortisol clearing techniques (deep breathing, imagery, yoga poses, prayer, whatever works for you), and look over your list. Go down it like a checklist and remind yourself that although she is fussing, you are being a good mother. The feelings of being a bad mother WON'T GO AWAY, at least not at first, and probably never. They'll diminish eventually and you'll be able to step outside of them and recognize them as feelings and not reality. In the meantime, you can manage the feelings from a more developed part of your brain instead of just reacting.
I have been honest with her and have told her that when she acts like that it really hurts me.
I know parents who tell children how the child's actions make them feel and truthfully, I don't like that approach. I think it's very important that children are helped to notice the reactions of other people to their behavior ("when you said that angry thing to that other child on the playground, that child looked scared."). But I don't think a child should have control over their parent's emotions. So I would suggest NOT telling her that she has hurt your feelings. How about this: tell her when she is saying those angry things that she needs to go to her angry place and say them. Give her a spot where she can say angry things and then when she is done saying them she can leave the spot. When my kids went through their inevitable mischievous cursing phases I'd tell them that those are dirty words and they could go in the bathroom to say them and they needed to come out of the bathroom with a clean mouth. They would go to the bathroom, sometimes not so voluntarily, and curse at the top of their lungs, hoping I would hear and react. I'd manage my own reactions away from them. Better than giving them power over me.