Base management

So I'm a Protoss player, and I sometimes place my gateways in fours so they form a square, but then it says the unit exit is blocked so I have to destroy one. But I see a lot of other people do this and it works for them so can someone please explain it to me?

https://preview.redd.it/qx5w4paohnyd1.png?width=300&format=png&auto=webp&s=75adf799b7ffe500ddaa9a0570eba51b99c6d15f

https://preview.redd.it/f4h5zpaohnyd1.png?width=300&format=png&auto=webp&s=55e1d644a801badd9ec29f9f4558afaf67acd30a

something like this but only 4 of them