This only happens if you have clear water enabled in Optifine, since it reduces the light opacity of water enough that it is no longer seen as an "opaque" block (light level still decreases enough to stop it from spreading in deep enough water).

(I'm a bit surprised that sp614x still has not fixed this bug, which has been present ever since they added the option 5-6(?) years ago, and they apparently see it as a non-issue; I modified the grass code myself so full-depth stationary water will prevent grass from spreading. This also affects mycelium, which uses the same spread/decay mechanics as grass)