Subs are in certain depth and they don't change it. And it is very close to the surface. Normally subs would be much deeper and AOE of those weapons would not affect them at all.
Brilliant point.
The reason subs are so close to the surface is because the game engine is far from perfect. Not because they're supposed to be close to the surface. If the game engine was more realistic subs would be able to go down to different depths.
One possible fix is for submarines to go down as deep as possible, rather than being at a fixed depth. I have no idea how hard that is to code.
If that is not possible: once you recognize that subs aren't supposed to be close to the surface, and they are only represented in the game as being close to the surface because of engine limitations, there is no reason to allow them to be ground fired by battleships, at least, when they're not in very shallow water. Other possible fixes would be either (1) eliminate/reduce the ability to ground fire subs, or (2) eliminate/reduce the ability to ground fire subs when they are not in shallow water. Either one of those things is preferable to the current situation. Perhaps you could accomplish 1 or 2 by giving subs a different "hit box" when you're looking at AOE splash damage compared to when you're looking at direct fire like torpedoes and depth charges.
It would affect balance to do this (ground-firing subs at this point is an important part of the meta), but we can adjust balance by changing unit stats.