I could be Wrong. I remember back when the Sims 4 was coming out, they said if you make a path your Sims would always follow the path with out just waking though the yard. What happened to this? I'...
I don't remember this, but what you could do if you have a specific case where they walk off the path, use a very low fence along a part of the path. If you got Get Famous there is a fence that looks like a solid line, it means it is not standing up at all. It's used in Plumbob Studios to stop sims walking too close to technical equipment and such, and comes in several colors. If you don't have GF, there is a low garden fence that might work, too.