Imagine some settlers are looking to build a castle in an area of expansive plans discover a small, isolated mesa: the formation has a very steep face, rising up 10-20m. The area of this formation just so happens to have just enough surface area for the castle they would build there. The builders would construct an sort of earthen ramp along the face of this formation to be able to reach the gate. However, there is also the rest of the vast plain where they can build the same castle at the same elevation as everything else.
Generally, holding the high ground in battle is advantageous, as Obi-Wan et al. have proven. In this case, are there inherent risks to building an elevated castle that one on flat terrain doesn't need to consider? Is the extra visibility a concern? Given medieval weaponry as advanced as catapults, crossbows, etc., is there a serious threat of undermining the walls? What if early gunpowder weapons like cannons are introduced?