Configure listen_addresses automatically in custom installation
The easiest solution is to append:
listen_addresses = '*'

to postgresql.conf after running initdb. As the last occurrence overrides earlier ones, this would even apply if the default entry were commented out.
Db cluster has to be restarted/reloaded after  that.