Villagers have frequent difficulty pathfinding to their beds or workstations and sometimes gets stuck standing outside the house wherein their bed is located as if they can't detect the doors to go inside. They also get stuck inside the house after sleeping in bed and could not also detect the door to go outside.
Linked issues
Comments

This seems similar to what I observed. When villagers try to find and sleep in their beds they get stuck at a corner outside the house
I'll resolve this as a duplicate of that ticket then, at least for now. Please try placing blocks in all such corners that villagers try to pathfind through. If the issue persists after that, please leave a comment, so we can investigate futher.
Does MC-142817 describe your issue?