How to reproduce
Create a superflat world in creative that has the preset:
minecraft:bedrock,5*minecraft:stone,5*minecraft:dirt,5*minecraft:sand,minecraft:water;minecraft:deep_ocean;oceanmonument,biome_1
Get away from any shipwrecks and ocean ruins (so that the enderman can't teleport there)
Spawn an enderman in the water and it wont teleport anywhere
Run the command:
/fill ~ ~ ~ ~63 ~ ~63 minecraft:cobblestone_slab[waterlogged=true]
Spawn an enderman on said giant slab of submerged cobblestone slabs
→ Notice that the enderman is teleporting
Note
The reason why this is a glitch is because of the inconsistency of endermen teleporting or not in the water.
Thanks for formatting it better!