Passive mobs are immobile when being led through water by food (wheat for cows/sheep, etc.), they can however be nudged or pushed.
Workaround: use a lead or boat to move them 1 by 1.Hostile mobs stop following in water or move negligibly slow. This doesn't seem to affect slimes, guardians or baby zombies.
Also of note, hostile mobs (only tested with zombies) do not seem to like to walk over or on rails. They seem to treat them as holes in the ground, and when standing on the rails they almost always prefer jumping while spinning in circles rather than chasing the player or testificates.
I'm uploading videos now, should be done within an hour.
Linked issues
Comments


To add to that,
Also of note, hostile mobs (only tested with zombies) do not seem to like to walk over or on rails. They seem to treat them as holes in the ground, and when standing on the rails they almost always prefer jumping while spinning in circles rather than chasing the player or testificates.
This is intended.
Thank you for your report.
However, your ticket has been resolved as a duplicate.
This issue has been linked to the original bugreport: MC-48616. You can find or add further information on that report.
Please search before reporting any bugs, as it's likely that one exists already.