/var/lib/lightdm/ contains xdg files

To prevent the coredump, my work around is to put a wait on greeter-setup-script in lightdm.conf until hostnamectl --transient is valid.
How to set the hostname assigned by DHCP server? fallback-hostname breaks transient hostname - #6 by stargazer

The above solution has been improved and it solves 2 issues:

  1. gtk-greeter fails
  2. lightdm restarts even with the greeter-setup-script, but it prevented the segfault

The new solution is to create a systemd service that lightdm requires. The service will wait until the transient hostname is set by dhcp.