Baseball is about the only sport with unwritten rules. It’s tradition.
I think just about every sport has unwritten rules. It's the sort of expected behaviour and etiquette most participants generally adhere to.
Like you say, they develop over time and become traditions in each sport. Perhaps in some sports *cough*baseball*cough* you get more, and more complex and convoluted ones, than some other sports.