In nature the weak can coalesce and attack the strong who are always out numbered. I saw a group of black birds chase away a hawk. The hawk could easily kill any one of them but as a group they easily drove the hawk away.
Just about every time we go for a drive I witness just what you described. The black bird dives at the hawk, pokes him in his backside with the sharp beak and flies off.
It’s simple, the hawk is defenseless while in flight and does not like pain.
We have lots of eagles up here, and I’ve never seen a smaller bird go after them the way they do with hawks. My theory is an eagle can catch them while in flight, and the smaller birds know it.