So it isn’t like the CO or the OOD wasn’t paying attention and drove the ship onto the sand bar.
Actually, if the pilot wasn’t in charge while onboard and during a docking operation, it would make ports worldwide become rather … reserved when dealing with any USN ships.