Short answer. It protects both. Article 686 states that the legal easement of lateral and subjacent support is not only for buildings standing at the time excavations are made, but also for constructions that may be erected afterward. A neighbor cannot excavate on the theory that only existing buildings are protected.
What the law says
The legal easement of lateral and subjacent support is not only for buildings standing at the time the excavations are made but also for constructions that may be erected.
Civil Code, Article 686 — Lateral And Subjacent Support. Read the full provision →
The easement reaches beyond what is already built
Article 686 answers the timing question directly: the legal easement of lateral and subjacent support is not only for buildings standing at the time the excavations are made but also for constructions that may be erected. The protection this easement offers is not frozen at the moment an excavation happens. It extends forward to structures that have not yet been built, so a landowner's right to have their soil and future construction supported by neighboring land does not depend on having already put up a building before any digging starts.
Why the law extends protection to future construction
Lateral and subjacent support concerns the physical stability of land itself, the soil's ability to hold weight and resist collapse, not merely whatever happens to be sitting on it at a given moment. Limiting the easement to buildings that already existed at the time of excavation would leave a landowner unable to safely build anything new later, since a neighbor's earlier excavation could have already compromised the ground beneath a future foundation. By covering constructions that may be erected, the article protects the land's usability over time, not just a single, frozen state of it.
What this means if you plan to excavate near a neighbor
If you are considering excavation work near a neighboring property, you cannot treat the absence of a current building on that property as license to disregard the support the soil requires. The easement obligates you to avoid undermining the lateral and subjacent support of the adjoining land regardless of whether anything is built on it right now, because that land's owner remains entitled to build there later and have that future structure supported as well.
What this means if your own land is affected
If a neighbor's excavation has weakened your land's support, you are not limited to complaining only if you already had a building standing there. Because the easement covers constructions you may erect in the future, you retain the right to the support your land needs even if you have not yet built anything on it, and even if your plans to build only take shape after the excavation has already occurred. The support obligation runs with the land, not with whatever happens to be standing on it on any particular day.