Is removing localhost from trusted domains a real solution for false ".htaccess file is not working" error message?

Nextcloud version:

The issue you are facing:
Since the upgrade to version 29, I was getting this error message in “Security & setup warnings”:

There are some errors regarding your setup.

Your data directory and files are probably accessible from the internet. The .htaccess file is not working. It is strongly recommended that you configure your web server so that the data directory is no longer accessible, or move the data directory outside the web server document root.

So I made sure that my files are not actually accessible from the internet and my webhoster confirmed that mod_env is loaded in apache2, so the issue had to be somewhere else. This post

proposed to remove localhost from trusted domains in /config/config.php and it works, the error message is gone!

BUT: is this just preventing the test to work properly or is it a true fix?
I have no idea what localhost does, but it is still part of the in the Default config.php Examples of the latest documentation, so I suppose it is actually meant to be there?

config.php file prior to the change:

$CONFIG = array (
  'passwordsalt' => 'xxxx',
  'secret' => 'xxxx',
  'trusted_domains' => 
  array (
    0 => 'localhost',
    1 => '',
  'datadirectory' => '/foo/bar/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '',
  'overwrite.cli.url' => '',
  'dbname' => 'xxxx',
  'dbhost' => '',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'xxxx',
  'dbpassword' => 'xxxx',
  'installed' => true,
  'instanceid' => 'xxxx',
  'htaccess.RewriteBase' => '/',
  'appstoreenabled' => true,
  'logtimezone' => 'xxxx',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'updatechecker' => false,
  '' => 'stable',
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 2,
  'mail_domain' => '',
  'mail_from_address' => 'nextcloud',
  'mail_smtpmode' => 'smtp',
  'mail_smtphost' => 'xxxx',
  'mail_sendmailmode' => 'smtp',
  'mail_smtpauth' => 1,
  'mail_smtpname' => 'xxxx',
  'mail_smtppassword' => 'xxxx',
  'mail_smtpsecure' => 'ssl',
  'mail_smtpport' => '465',