And now that I checked it: I do have systems with gethostname() returning an FQDN, and other systems return the (short) hostname only.
The return of gethostname() depends on what has been configured. So, yes some people will prefer a FQDN while others will prefer a short hostname. Also, it's a POSIX standard function (see https://pubs.opengroup.org/onlinepubs/9699919799/), so I don't get why getting a FQDN or a short name depending on what people set would be a problem for Postgres while it's not for Linux.
And it gets worse when you're talking "container" and "automatic image deployment". So I believe it's a good thing when a database does not expose too much of the OS below it...
hostname (string, OPTIONAL) specifies the container's hostname as seen by processes running inside the container. On Linux, for example, this will change the hostname in the containerUTS namespace. Depending on your namespace configuration, the container UTS namespace may be the runtimeUTS namespace.