One is not arbitrary. It isn’t unreasonable to not want minors exposing their underwear in public and I shouldn’t have to tell you this. I understand that nudity(and states of undress) is more common in other parts of the world, and isn’t inherently sexual, but it is not appropriate in a school environment, especially where minors are within a system where a power dynamic exists.
Again I separate this issue from hairstyles, and I also clarify any evidence of racial targeting should be decried. Policy should be applied evenly and targeting investigated by those with ability to make corrective action.
Exceptions should be made for folks with particular features that cannot be changed. Such as those who naturally grow an afro, or cannot shave without irritation/infection. But pants are not the same, as they can be changed. If someone cannot afford a belt, schools could easily supply cordage.