A good solution is to use SQLite. It addresses the issues (pretty much by doing all the fsync etc mentioned including on directories) and has a very comprehensive test suite. It is also used very widely on desktops, mobile devices, applications etc. https://www.sqlite.org/whentouse.html

A notable quote: SQLite does not compete with client/server databases. SQLite competes with fopen().

I wonder what the implications of making an SQLite filesystem would be.

I'm not actually sure whether this actually helps with the problem described in the post, but such a thing does exist:

https://github.com/guardianproject/libsqlfs