Dear Artur,
There are any number of Buddhist legends of scriptures found in ruins -- e.g., the tale of the
siddha Maitripa rediscovering the Ratnagotravibhāga in a ruined stūpa.
The subterranean treasures guarded by nāgas and others may also be of interest here.
best,
Matthew
Matthew Kapstein
Directeur d'études,
Ecole Pratique des Hautes Etudes
Numata Visiting Professor of Buddhist Studies,
The University of Chicago