I was wondering why they built them like that too. Seems like you're encouraging invaders to come over the walls
Later additions called a glacis, ita hardened rammed earth with stone over it in most cases and it's used to deflect cannon balls away from the walls. https://en.m.wikipedia.org/wiki/Glacis
I hadn't heard of this city before, it looks pretty cool!
I was there a couple of months back, amazing place