Entering a cave” or rock was a metaphor for a shaman’s altered state; therefore, caves (and rocks more generally) were considered entrances or portals to the supernatural world.
James David Lewis-Williams, The Mind in the Cave: Consciousness and the Origins of Art
consciousness, upper-palaeolithic-art