Nah my idea in that thread would have the exact same problem actually. It assumes empty space behind the target, otherwise the wall behind the target would be the first thing hit.
A better system would probably have a bunch of potential "cover locations" at all times set by the player position, and the enemies would pick the one with lowest pathfinding cost, since the nearest point by distance may not always be the shortest path.
Unfortunately I'm not seeing a way to get the path length with the built in pathfinder expressions, besides which it could get quite costly to find a path to every potential cover location just to check the distance.
Getting the path length is possible by looping through all the generated nodes after finding a path, but it would still need to be calculated and compared with all potential pathfinding targets, which sounds awfully heavy to me.