Change postgres default behavior for connection to database when dbname not supplied
According to the same Postgres documentation

The following environment variables can be used to select default connection parameter values, which will be used by PQconnectdb, PQsetdbLogin and PQsetdb if no value is directly specified by the calling code[...]

PGDATABASE behaves the same as the dbname connection parameter.


If you want psql to fail if the database name is not explicitly given on the command line, set the variable PGDATABASE to point to a non-existent database, e.g. export PGDATABASE=&quot; &quot; or export PGDATABASE=&quot;&quot;.
As to your question:

whether or not the default behavior can be modified to not connect to a database named after the user if no database name is supplied either through an environment variable, or the psql command line utility.

we can find a definitive answer in the libpq source code:
/*
 * If database name was not given, default it to equal user name
 */
if (conn-&gt;dbName == NULL || conn-&gt;dbName[0] == '\0')
{
    if (conn-&gt;dbName)
        free(conn-&gt;dbName);
    conn-&gt;dbName = strdup(conn-&gt;pguser);
    if (!conn-&gt;dbName)
        goto oom_error;
}

The only way to modify the default behaviour is to edit the code fragment shown above and recompile the library.