Note that this already exists on top of SQLite proper - authored by Ben Johnson (Litestream, Fly.io etc.) - https://github.com/benbjohnson/postlite
Postgres also can't be embedded (according to some brief googling), so you'd need to run it as a separate process.