Just a guess, but I bet very few of the students wearing hats indoors are doing so for religious reasons. I’m puzzled by the American obsession over what to wear to school but I acknowledge it exists and is part of the general attitude toward education. Many other countries with very successful educational systems don’t have this focus and in fact wear school uniforms without issues.