This bug is extremely frequent in the Waterfront Lots. I encounter it all the time in Sulani. When I load a beach lot, the glitch usually happens when a sim jumps off the waterfront ladder and climb out of the water using the waterfront ladder. Might be worth playing Island Living to explore all the instances where this bug happens.
Merfolk that get stuck with a tail can swim through the ground.
Sims uisng the ladder by the water encounter this problem... Actually that's one thing I don't get. Merfolk can use pool ladders but not the waterfront ladders?
If there's a problem with sims swimming, I would start by looking at the code that makes merfolk "hidden." Merfolk have both a human and merform while swimming depending on the perspective of the household. It's the merwoke feature at work. I suspect it's also why merfolk can end up swimming wrong, they still do that by the way.
In the process of trying to hide merfolk, they might have created a number of bugs do to conflicts in the game's code. The merwoke feature doesn't even work properly as merfolk still swim with their merform regardless of whether or not a household is merwoke.
What I'm trying to say is that the release of Island Living also came with swimming bugs. Swimming through the ground is only one example. I've had celebrities walking on water for watcher's sake.
I wonder if removing the merwoke feature would make a difference. Let merfolk have a merman or mermaid form in the water and swim like they are meant to. Let them use their human form on land. Don't try to have merfolk use their human form in the water... disguising merfolk just doesn't work very well. But, it's how merfolk swim in different ways, can and can't use ladders, and etc. that might be a place to replicate this bug. One of the pictures were of Iona even. She's a premade mermaid. I'm not sure the open world swim spots were even a thing in the Sims 4 before Island Living. So, the place I would look for the cause of the bug is Island Living.