Yeah, agreed. The first code violation was ticky tack but it's the rule and a call the umpire was within his rights to make. That's her coach's fault and every player who gets called for a coaching violation disagrees with the call. I'm pretty sure racquet abuse is an AUTOMATIC code violation. That's clear-cut and so far everything was normal course of business.
Serena's frustration down a set and a break makes sense but she had to know where she stood if she referenced the earlier point penalty to the umpire when she REPEATEDLY kept going after the umpire. You can't even argue with the second code violation.
Could the umpire warned her that she was close to another code violation? Sure, but he shouldn't have to. Had she gotten her frustration out once and let it go it would have been fine. The problem was Serena wouldn't let it go and kept badgering the umpire. More than anything she said, going back for more is what caused the umpire to lose patience. Down a set and break, and two code violations is a terrible time to keep going.
What gets lost in all this is that it's simultaneously possible to be one of the best players ever and have an unsportsmanlike moment at the same time. Had she apologized for losing it in the heat of the moment we would have forgotten about this already. Doubling down on the "it's not fair and I did nothing wrong" isn't a good look. She had a role in all of this.
The high school tennis equivalent of what Serena did is the kid who blows up and goes over the top after his opponent makes a correct but late line call.