The troglodyte habit is often attributed to a need for places of refuge and concealment in troubled times, suggesting a chronology linked with either the Arab raids of the seventh or ninth centuries or the Turkish ones of the eleventh century. The habit itself does not, however, imply such a need. In fact, rock-cut villages often occupy conspicuous sites…Instead, as noted above, this mode of architecture should be seen as a logical response to the local conditions. The millstone closures, which appear formidably defensive to an eye accustomed to built architecture must also be seen in this context: when timber is scarce and the soft rock easily worked, such a closing method for seldom-used storage cavities may be more efficient than conventional door. The rock-cut villages cannot, therefore, be assigned with certainty to the periods of turmoil. There is certainly no question of concealment as far as the cave churches are concerned, since they are often located in prominent sites and many also have elaborate carved facades. Nor is there reason, therefore, for assigning the churches to periods of insecurity.
That is from Lyn Rodley’s classic Cave Monasteries of Byzantine Cappadocia, a book which you read only if you are going to…Cappadocia.