If you look at projects like SQLite or PostgreSQL, you’ll see all the fantastic, precise logic you need in order to ensure expected levels of consistency when you are using real filesystems to store data in a database. These problems come with serious enough pitfalls and traps that it’s common to see blanket recommendations to avoid directly interacting with the filesystem altogether, and simply do everything through SQLite or another library when possible.
At the other end, if you look at GUI applications, the filesystem is a bit lower-level than it should be. At least, the Unix concept of filesystem is too low-level. If I open a file in a word processor, save it, shouldn’t I be able to move around the file and rename it in the file browser, without affecting the relationship of that file to the word processor? This is possible on a Mac, but this is done with APIs inherited from the pre-Unix days of macOS.