If bosses are being unprofessional, you’ve got the high ground. I’ve had a team leader bawl me out in the middle of a packed open plan office before now. My reaction (after I’d quelled the initial desire to defenestrate him) was to say “office” and walk to the nearest empty room.
He followed, still raging, and once outside I quietly explained that his behaviour was unprofessional and I wasn’t prepared to stand for it, and if it happened again I’d be taking it up with his boss and would consider tending my resignation and pursuing constructive dismissal proceedings. It was a risky gambit and I was running on adrenaline, but it didn’t happen again.
Mostly though, when I’ve had Big Bosses who are unreasonable bullies, the only way I’ve ever fixed it is by voting with my feet.