"Realism" has little to do with it. Ships are defenseless during upgrades mostly as a game balance feature. Usually it's for when you upgrade deep in the reaches of space in enemy territory. That way you can't send out a lightly defended ship somewhere and turn it into a Death Machine in two to three turns. Well, you can, but you have to worry about someone tapping you with a pointed stick in response. 
With pirates running around, it's also meant as a brake on the player/AI so they won't just send out ships willy-nilly and upgrade without any concerns about loosing the ship.