Plenty of small birds do not nest in tree cavities. Chipping sparrows[1] for example do not and are of similar size. Hummingbirds also do not. Meanwhile, owls live in nest cavities and most are larger than songbirds.
That said, the going theory about why some birds choose to nest in cavities is lower mortality rate in their young. Birds who nest in boxes typically have more babies per clutch than those that do not so perhaps that's it? I take that more as no one really knows why one species does while another of similar size does not.
Another random observation is most large birds walk and smaller birds hop. That's not always true either, since blue jays hop and crows will walk and sometimes hop. Hummingbirds cannot do either and just shuffle side to side on perches.
I guess I'm trying to say there's exceptions to the rules in bird behavior, but they're more outliers.
[1] https://brighamstephen.wordpress.com/wp-content/uploads/2018...