A possible fix could be, that each block that is workable by a villager has a "claimed" attribute, perhaps linking to the villager UUID or a boolean. If the block is claimed, no other villager seeking for a job is assigned. The claimed attribute is removed if the assigned villager (coordinates of workplace are also saved in a tag) is killed (remove tag from workplace coordinates block) or the pathfinding fails. For possible concurrency problems a semaphor might be used instead.
Furthermore, this could also be enhanced by the system I proposed in MC-159675, but this might cause concurrency problems aswell.
A possible fix could be, that each block that is workable by a villager has a "claimed" attribute, perhaps linking to the villager UUID or a boolean. If the block is claimed, no other villager seeking for a job is assigned. The claimed attribute is removed if the assigned villager (coordinates of workplace are also saved in a tag) is killed (remove tag from workplace coordinates block) or the pathfinding fails. For possible concurrency problems a semaphor might be used instead.
Furthermore, this could also be enhanced by the system I proposed in MC-159675, but this might cause concurrency problems aswell.