Based on my considerable, though somewhat outdated experience with nuclear fast attack submarines, , we do not have enough data to 2nd guess the decision to repair or not.
Depending on the extent of the damage the structural integrity of the pressure hull may well have been compromised, the boat could conceivably even be bent. In addition, most of the internal structure is mounted on sound isolating platforms. Those structures likely experienced significant damage, if so repair could even require major hull openings to be cut in to the hull.
There is a definite cost/benefit analysis that has to be made based in part on the projected remaing service life of the boat if repaired against the cost to repair vs. using that money on new construction.