Everyone commenting should actually watch the entire match and post-match ceremony to actually understand the sequence of events.
The penalty for coaching was definitely a little dubious. Her coach made a gesture with his hands, which he fully acknowledged in a subsequent interview, but it was low and mostly hidden by the person sitting in front of him. It was the kind of thing anyone who gets really into a sporting event might do. As far as I can tell it wasn't as if Serena was staring up at him looking for signals -- the ref simply saw him gesture with his hands and made an assumption. It was no different than what tons of other coaches do to other players. Serena obviously took major issue with the call. Her comment about a thumbs up is because she assumed that's what the ref saw. I think in her mind she assumed things were resolved (obviously not a good assumption, but perhaps understandable in the heat of competition and with emotions high).
She didn't have any issue with the racket smashing penalty. Happens all the time in tennis, and she didn't bat an eye about the subsequent penalty.
The final penalty for harassing the ref or whatever was a questionable decision. This kind of thing rarely gets called, and it wasn't like she was holding up the match since it was during a changeover. She called him a "thief" -- big deal. She needed to blow off some steam, she wasn't threatening him, and he could have just ignored her. Another option was to warn her that if she kept it up she'd get a third penalty and would lose a game. I agree that her trying to claim sexism was dumb.
Lastly, and most importantly, she was extremely gracious in defeat and gave praise to Osaka. She even asked the crowd to stop booing so that Osaka could enjoy her moment. She in no way tried to act as though the outcome was decided by her penalties. She knew she wasn't playing well, but in her mind she wasn't given a full chance to try and turn things around and extend the match to a third set.
All this being said, at the end of the day it was still her strong emotions that ultimately caused everything. It's what makes her so great and exciting to watch but can also lead to sagas like this.