My high school job is shelving books in a library. It is a great job, good pay, wonderful coworkers, and flexible hours. They also have a relaxed dress code, which is basically the same as the local school system’s. That’s actually how they described it to newcomers: anything they can wear to school, they can wear to work at the library.
At another branch, the students started regularly wearing torn jeans to work. The main office saw this and thought it looked trashy, so they made a rule: no more jeans. Every other kind of pants were fine, even sweatpants, but no jeans.
So of course, now I can wear a pair of torn khakis with holes in the knees, according to the rules, but a nice, new pair of intact jeans are not allowed. I don’t think banning jeans in itself is a stupid and unreasonable move, but if they had a problem with the condition of them, it makes more sense to ban any pants in bad condition.