冒 already drew a head with a covering over the eyes; adding the cloth radical 巾 made the covering explicitly textile. 帽 is the cloth that risks nothing and covers everything — the head's roof.
Hats once encoded rank: officials' 乌纱帽 'black gauze hat' became the very word for holding office — 丢了乌纱帽 'losing the black gauze hat' still means getting fired from a government post. Modern 帽子 also means a label pinned on you: 扣帽子 is unfair accusation.
Cloth 巾 that covers 冒 your head — a HAT.
帽子戏法 'hat trick' came straight from soccer commentary into Chinese — three goals, one borrowed idiom.