I believe the stated in universe reason for putting the bridge is top is twofold:
1. Putting the bridge on top lets them design it as a replaceable module they can swap out for upgrades and refits. Precisely
why starfleet values that capability so highly I don't understand, though out of universe it's so the production team can explain their habit of using different bridge sets for the same class of starship.
2. They decided to put sickbay in the center of the hull for maximum protection, and so the bridge can't go there since that space is full (implicitly, they also don't want to put the bridge anywhere near that area, to avoid drawing fire toward sickbay).
Based on point 2, I think starfleet envisioned the most likely result for a ship that's defeated in combat to be a badly mauled wreak, without it's weapons, shields or main power, but physically intact to the point that people can keep living on it for a while until they're rescued, and ships are designed around that rather than towards "the enemy will keep shooting our ships until they explode and kill everyone".
Well, it's better than the current trend of nuTrek which literally turned the viewscreen into a windshield. Plus on real ships, the CIC is deep in the ship, and the bridge is just there to steer the ship with, with the commander actually being in the CIC and telling the bridge what to do.
The bridge window is actually the only JJverse design feature that I like. It has no real downsides, you can still use holographic displays for ship to ship coms and all the stuff they used to use the viewscreen view, and it looks very cool.
The other issue with the "put the CIC in the smart spot" concept is you have to actually
do something with that idea. Halo has the Covenant bury their CIC deep inside the hull for protection, while UNSC ships have theirs located at the top or front of the ship. In the course of about 20 years of games and fiction, that difference has never once mattered one bit.
Yeah, that's a bugaboo of mine too. When a weapon has already defeated the ship's shields and armor, it's unlikely twenty feet of air and a couple of layers of space!sheetrock wall are going to miraculously provide enough protection to matter. Most ships that don't have some kind of armor get cored by a direct hit if their shields are down, no chance being in the middle of the ship will provide any protection.
It's not always
quite that bad, ships can withstand a bit of a a beating without shields. First example is Voyager in Year of Hell, where they fought an enemy with weapons that could completely bypass thier shields. Yeah, it was a constant one sided ass-kicking, but they survived repeated direct hits, and the ship was still functional even when it looked like this:
(granted, they would have died well before that point if they weren't able to run away, and patch up the worst damage, but it's still impressive how much damage they could take and still keep flying).