Today’s lesson: On systemd systems, override the postgresql-10 service’s idea of the value of PGDATA before running postgresql-10-setup initdb.
Even if initdb succeeds, postgresql-10-setup will fail if the service’s PGDATA does not look like a database directory.