I found this on Mojang bug tracker that's still unresolved, and reported also for versions 1.17.0, 1.17.2 Hotfix:
This report covers any of the following occuring without a game crash:
- Chunks (portions of the world) being wholly or partially (i.e. below a certain Y-level) deleted and turned to void/air
- Chunks being reset to a state of initial generation (This may result in the chunk not matching surrounding chunks that were generated in an earlier version.)
- Chunks reverting to an earlier saved state (usually the state the chunk was in before the last time that area of the world was visited)
Which seems your same problem. If you need a fix, there's none at the moment...
From a mod's comment:
Unfortunately, there is no way to make the chunks that have been voided come back. The data for those chunks is simply gone. The only thing you can do for future protection is make manual backups of your worlds regularly and restore one if new chunks get voided.
And regarding the technical reason for this, another mod wrote:
It looks like the data loss doesn’t always affect the entire chunk. In some cases surface (topmost) chunk sections are spared. I think this suggests the issue is related to loading optimization.
It's not clear why it happened, but the bug is known and a lot of issues have been opened. I suggest you follow the thread to receive updates as soon as they occur.
UPDATE:
According to the same Mojang bug tracker page, this glitch was fixed in 1.18.0 version update.