I once implemented a PostgreSQL client that didn’t use libpq either.
You might find it interesting to examine the differences in implementation approaches.
(I haven’t been updating it much recently, but
Hackage
postgresql-pure
pure Haskell PostgreSQL driver