Minecraft question what has been happening to my villagers?

Some of them have stayed in a community about 200 blocks away, but is it because there are animals there?

Nnaybe its because their programmed to stay in their village

There was a bug when 1.14 came out where villagers could wander too far away from the village. When a villager is too far away, it will no longer recognise the village as their home and will just be a rogue villager. You could be experiencing this, especially if the world was created when 1.14 released