I'd echo the suggestion to strace this. You can use the pre_auth_delaysetting to help facilitate that. See:
https://www.postgresql.org/docs/current/runtime-config-developer.html
Cheers,Greg