Well I tried that and you are partly right. If I build a home near a villager during sunset he will go there when night starts. However, during night he won’t change to a new home nearby when I destroy his current one. That’s the problem because it prevents me from ‘relocating’ him to my village.
Maybe there’s some (long) interval for those checks and one fixed check at night start, I dunno. Will further experiment with this.