Actually there are lots of fairly commonplace techniques usable these days to preserve information for a long time.
Some that come to mind from past publications are using things like high energy lasers to encode information into markings on/in // crystal defects in // holograms on/in // etc. various robust materials like quartz, diamond, metal, whatever.
If you think about "room temperature" or at least an extended domain of possible environmental temperatures then you can look at materials science / chemistry and ask "at such a temperature, for such a time, how long does material / composite material / structure X take to change by some physical / chemical process?" -- where the process can be things like oxidation, rusting, molecular bond breakages / mutations, erosion, sublimation, incineration / burning, erosion, spalling, crack formation & growth, crystallaization changes, etc.
As the OP pointed out wrt. examples like cuneiform tablets, pictographs, carvings, etc. most materials that are basically crystal / rock are possibly fairly stable for thousands of years, and even pictographs like paintings, dyeing, writing on fiber can also be so. It depends on presence / absence of fire, water, erosive forces, freeze/heat cycles, organisms that may impact the surface (mold, lichen, coral, bacteria, plants, ...).
Even the library at Alexandria might've survived and preserved much of its information over thousands of years had man made causes of apathy, neglect, destruction, et. al. not caused it to fade into time.
https://en.wikipedia.org/wiki/Library_of_AlexandriaIIRC some of the greatest ruin of archaeological sites like the great pyramids have occurred mostly in fairly modern times, certainly there are famous examples of WW-I and WWI-II caused damage to many sites. IIRC many early civilization archaeological sites and artifacts were destroyed or taken just over the past few decades in conflict in / around Iraq et. al.
So on the one hand protecting against information loss due to material / information recording device failure is one thing. Protecting it against the natural environment (temperature changes, freeze, fire, atmosphere changes, humidity, water, biological infiltration of plants/bacteria/fungi/... is another. But protecting it against pillaging, thoughtless destruction, war, etc. from mankind may be the one of the hardest challenges.
"Foundation" again. What do you do when your own civilization itself is part of the problem in preserving a library?
Humanity has already created artifacts that might outlast our civilization and possibly species to be discovered, perhaps, in future time :
https://en.wikipedia.org/wiki/Pioneer_plaquehttps://en.wikipedia.org/wiki/Voyager_Golden_Recordhttps://en.wikipedia.org/wiki/Lunar_plaqueCertainly it would be "easy" to leave a few exabytes or whatever scattered around various parts of Luna or Mars or Phobos et. al. Also some "time capsules" on mountains, in deserts, and whatever other places are likely to (at least in part) survive short term plate tectonic subduction, vulcanism, the next glaciation, perhaps a significant asteroid/comet impact event, war, flooding, etc.
People are already burying nuclear waste and such in mines and geological formations that, it is claimed, are likely to be stable from geological activity and flooding for thousands of years.