How can you prevent village babies from running away in Minecraft?

ar
1

I built a Villagerbreeder in Minecraft (Bedrock Edition). The babies are brought to the center by cart. Then they are set down on the activation rail and then have beds, etc. But I have a problem. The babies are a bit smarter than me and just run into the 1 by 1 rail tunnel and then just walk away. Is there a way to make a 1-by-1 block with a rail in it impervious to village babies?

al

Drop the Lohre two blocks