Clearly *some* ship building is done in conjunction with the private sector, but the two examples, famous though they may be, are both unusual ones. And, it should be pointed out, are Spinward Marches designs that are not fleet ships.
The Kinunir class is, by Naval standards, tiny. At best, it's a local Marches project that failed. It's no stretch for a commercial yard to build, though final fitting of the
and the
would probably happen at a navy base.
The Lightning class is a 60,000 ton cruiser. Not insignificant, but also small enough that a big commercial yard might be able to manage it. Again, it appears to be a Spinward Marches special.
I would think that FLEET assets, would need specialist yards big enough to handle those large, armoured hulls, spinal weapons and other purely military things. And of course the Navy would be keeping all that under naval security and oversight. Even with a private concern being involved, they'd be contractors, and the yard would be overkill for any commercial ship.
To put it in real world context, no one ever designed and built an Aircraft Carrier or (in the days of Battleships) a Battleship and shopped around for a buyer. Second hand ones get sold by navies, sure, but that's military surplus. Smaller ships DO, though, especially utility and patrol craft.