Question: why do villagers need beds?
Answer: Villagers must have enough beds within village bounds for baby villagers to spawn. The beds must have two blocks of clearance above them because there needs to be room for the baby villager to jump on them. This means that the baby villager needs to be able to path-find the bed; it can't be in an unreachable spot.