At one point I had to inventory every... single... weld... on the ship because we questioned their quality.
At another time (2007), a diesel engine en route to the ship fell off a truck and crushed a car, barely missing a woman who was sleeping in the back. Nothing to do with the ship's quality, but imagine getting that news while already putting out so many fires.
On the bright side, I got to be onboard one of these ships during a multi-day sea trial, which was a lot of fun.
With all that said... It is completely unhelpful to compare the cost of a military ship to a commercial ship. The commercial ships are very simple and cookie-cutter[1], unlike military ships that are almost always new designs and involve complex, integrated systems such as communication, defense, hospitals, refueling, etc, etc.
[1] I wrote about this just last week: https://www.gkogan.co/blog/simple-systems/