LHTR 2.0 says to this:
“If the attacker has not withdrawn all units, defending submarines may submerge.”
This implies defending subs submerge after the attacker has chosen to either retreat (or submerge) or not.
(page 16 - Condition B) Defender withdraws subs by submerging)
Page 14 is more to the point.
It categorically states that the Attacker choses to press the attack or retreat BEFORE defending submarines chose to submerge or remain surfaced.