So i made a village close to my house but I put fence all around it. 2 did escape, I don’t know how since I checked all the fence. But then when I logged in there was one in my house and I just assumed it was one of the escapees, but when I looked in my chest and turned around again there suddenly were 4... and I went to look and the 2 escapees from before were still in the back behind the village. Can they spawn naturally around a village?
Villagers never naturally/randomly spawn; they can only spawn during world generation in village houses and igloo basements, breeding, or a player curing zombie villagers. So you must of have more escape than you realized, or your house has multiple beds (they will breed up to one villager per bed; in this case the sudden appearance of more villagers should have included children):
When I protect a village I build a wall around it, at least 3 blocks high with ladders placed at intervals (one ladder on the middle block) so I can get in and out, with the only mobs able to get in being spiders (I fixed the aforementioned bug but I still don't 100% trust partial blocks like fences, or surrounding a villager with non-transparent blocks to keep them in place).
I also was in my house just with the back to. And i did not hear anyone enter the house, so they did not come from outside since no doors opened. So they had to spawn. But why 4 when there's only 1 bed