So, if a sub were to attack a loaded carrier and get a hit, it means that the fighters would not get a reply to the sub?
Correct, as the fighters - though defending in the air - cannot hit the sub.
I’ve always read the rules as attacking planes cannot hit subs without a destroyer present …
Actually this is what the rules say:
If a destroyer is in a battle, it cancels the following unit characteristics of all enemy submarines in that battle: Surprise Strike, Submersible, and Cannot Be Hit Be Air Units.
Cannot Hit Air Units: When attacking or defending, submarines cannot hit air units.
Cannot Be Hit by Air Units: When attacking or defending, hits scored by air units cannot be assigned to submarines unless there is a destroyer that is friendly to the air units in the battle.
… however I thought that defending planes were able to get a defensive roll since subs would surface to attack.
This thinking is not covered by the rules.
I also think that the surprise attack means that any unit hit does not get to respond unless it is a sub because it is defending at the same time as the attack.
A battleship - when only damaged by a sub’s surprise strike hit - would be able to fire back, too.
On attack, only a destroyer from the attacking side negates the sub rule however any defending destroyer negates any attacking sub.
See the above rule quotes.
I am not sure if I have understood every aspect of your confusion correctly so please ask back, if anything remains unclear.