There is no arbitrary, it is how the individual lives within its society and "gets assigned" once that individual sets certain parameters. Most common one in pretty much all cultures is coming of age. One is not born a "man" or "woman" in any society. One most "earn" the title. Now, in most modern western cultures, the title is easy. Exist for eighteen cycles of the earth's revolution around the sun. Probably one of the most arbitrary markers. Prior remnants of other gender defining moments still exist, though. In Mexico, you have quinceañera, which shares the arbitrariness of sun revolutions, but in this case, concludes at fifteen.
In other cultures, it's completing an event, a proof that you are what western culture might define as "man." There are plenty of examples. Land diving is one.
https://news.nationalgeographic.com/news/2002/11/1125_021126_TVVanuatu.html
Gender is never arbitrary. It's never immediately set, either. In many cultures, like the one I link a few pages ago, there are different gender roles individuals can fit into. In cultures with only two genders heavily influenced by biological sex, those that do not fit the profile are left with little recourse, identify with the other gender, or essentially be nothing.