I find upgrading ships costs money and time is realistic. It takes time and money to put new systems into a vessel and that systems won't come out of nowhere, they have to be produced. And while in shipyard, a battle ship is nothing more than so much tons of dead metal, an easy target for every one.
For myself, I re-designed my ships quite often. Either to redegisgn it to match a new thread or simply because a newer tech grade gives more room on your ship and I wanted them as effective as possible, So after a new tech level (sometimes, not every time) you gain some free space that you can put something userful into (additional shield generator, armor, some other gimmick).
I couldn't refit all ships of course (that's too expensive), but I always wanted new ships be as optimized as can be.
To prevent your ship from being easily killed while refitting, I'd propose a shipyard orbiting a planet (and its defenses). This under refit won't help defending the planet, but an attacker had to crack the planets defenses to take out your ship as well.