Hats have all sorts of extra benefits apart from being worn on the head.
One experienced captain in a company I once flew for never came to work with any form of brief case - his licence and headset were in his hat!
Notwithstanding the different views on wearing of hats it should, I feel, go without saying that pilots obey the uniform regulations of the company they are flying for!
Also there are different designs of hat - some being better than others.