The US military invested, and still does, a lot in damage control and survivability. Everything is designed to maximize the equipment and people that can survive to fight another day. This has a significant cost, but the US has always leaned into their prodigious production capacity in support of this objective. This is doctrinal and fundamental, the US really goes to great lengths to make sure every soldier comes home, preferably with minimal damage.
In a long war, experience compounds. You can build a core of savvy battle-hardened veterans in a matter of months if your soldiers can learn the necessary lessons of the conflict without dying in the process. Experienced savvy soldiers are effective and difficult to kill. In many military traditions, these lessons are learned immediately before dying. US doctrine is that they learn their lessons quickly, survive, and adapt. That may not always come off, but that is the approach and has worked well for the US. There is no substitute for contact with the adversary when it comes to learning; how quickly you can adapt to those learnings determines outcomes.
No country's military is ever prepared for real war. US doctrine has been that they will survive their hard lessons, unpleasant as they usually are, and leverage that experience behind their vast productive capabilities. With respect to the US Navy specifically, the US has always had a strong naval traditions, by virtue of their location in the world. Even when they aren't at their peak, they've always known what they are doing.