Mostly because these ships designed well before radar technology become widespread and what you said applies to every warship and every navy, even today, though today weather protection applied. But by then they needed them as fast as they could be produced and installed. A good strafing run could easly damage them. Look at the Essex class in 1944/45 almost all of their radars are concentrated in one position around the funnel:
a few hits even from light calibre weapons could disable or even destroy them.
Wiring had to go from the radars to the radar rooms and often it was easier to put them on the walls which though made them more vulnerable but it was easier to repair too!