The easiest way would be to use paper spigot. It got way more optimizations than normal spigot and you can access the pathfinder of every mob easily.
Villager entity = // your entity
Location location = // your location
entity.getPathfinder().moveTo(location);
https://jd.papermc.io/paper/1.21.1/com/destroystokyo/paper/entity/Pathfinder.html