fakeroot provides a functional example of an LD_PRELOAD hack that is actually useful; however, fakefs must do a little more to virtualize all of the filesystem operations. Also note the semi-elegant way that fakeroot handles a very inelegant situation: executing a setuid program.
Database access should not be implemented inside the processes running under LD_PRELOAD conditions, due to the heroic efforts required to keep the Berkeley DB implementation hidden from the process that it is sharing symbol table, address space and file descriptors with. This is hard enough with the plain Berkeley DB version 3 .so library and libnss_db.so without any LD_PRELOAD hacking at all. Importing all those symbols into arbitrary programs, some of which may then turn around and attempt to use Berkeley DB, it just asking for trouble.
This is the motivation behind fakefsd--to put all of that goo in its own process, and simply communicate with it from the LD_PRELOAD-hacked binary using a message-passing interface. See section 14.2.