I might be a bit far off but I have a nearly 4 year old who started similar behaviour at the end of my pregnancy / first few months of new babies life.
My first response to my, usually sweet and pleasant, little girl turning into the devil was to react to her anger etc with anger. I literally mirrored her as I was annoyed at her as I knew she could be/was/used to be a well behaved child. It was my natural response, no thought or plan to it.
When this didn't work, and her behaviour got worse, I had to really stop and think. That's when I realised what I was doing / what was happening. She was struggling and her behaviour mirrored this, I was disappointed (by her behaviour) and was being reactive because of it.
I made a real effort to stop being reactive. I stopped using the time out/naughty step as much, and I started making a huge effort not to engage her arguments.
It's still a work in process but her behaviour has definitely flipped, and she is much more the good little girl I know she can be.
Now when she starts to react in temper, or I can sense I tantrum coming on, I simply say to her "I am not getting into a argument with you" and will follow up with.. "Your choices are X or Z, you can choose but I am not arguing over it" or "I have asked/told you what to do, if you don't do it or continue to try and argue then you will be left/put on the step/have a toy removed"
I try my best to remain calm with her despite her efforts to get me to react as I have found the more I react the more she misbehaves. Its a knock on effect so if I can stop it at the start it saves a massive argument.
Once she has moved on/done as asked/made a a choice etc I then say something "Good job on XYZ, ow tell me why you acted that way earlier?" This allows her to speak to me when she is calm, and I hope it teaches her how better to react to her emotions.
For example one time I asked her to put her plate away while I was sitting with her brother and she started to fuss and don't listen, so I said to her "please put your plate away as I have asked, I will not argue with you over this I will just put Barbie away for the day" After a few seconds of fussing, she got up and put the plate away. So I said "Good job, now tell me why didn't you do that when I first asked you?" and it turned out she didn't want to leave me with her brother because then he got more time with me - so we spoke about it and I explained she sat on me/slept on me when she was little etc and now I make sure in these situations she gets invited up to snuggle in as well. I'd never stopped this before but this conversation highlighted that, for some reason, she didn't think she could just cuddle in anymore. Another example was "Can you get dressed so we can go out" she started fussing so I said "You can choose this outfit or this one, but I'm not arguing with you". She threw a tantrum at this so I gave her the options again, reaffirmed that I was not arguing and told her that if she continued to mishaved she would need to go on the step which would make her late for her lesson. She still pitched a fit so I calmly told her she needed to sit on the step to calm down before coming to talk to me. She sat there for about 5 minutes before removing herself from the step and coming to speak to me. This time it simply turned out she wanted to stay home and play, so we discussed that occasionally we need to do something we don't want to do, ie leaving toys, and how if she had explained that to me we could have just picked a toy to take in the car.
The way their little heads work is crazy but amazing. It's just trying to work it out that's hard for them and us.