Only enemy (in this case: German) DDs cancel the “cannot be hit by air units” submarine ability. So, the Allies cannot take the submarines as losses if they are attacked by german air without a german DD.
I have always been sceptical about this rule. Imho, it would make more sence if the “cannot be hit by air units” was an option for the defender, rather than an erga omnes rule. Because, since the attacker most of the times wants only to destroy the defender’s TTs rather than his entire fleet, he is actually compelled to leave his DDs behind, in order to prevent the defender from using his subs as fodder.
I understand this would be, prima facie, in favour of the Allies. But it could also increase the german med fleet survivability.