I’ve ascertained exactly what reproduces this:
#!/usr/bin/env sh
qdbus --system org.freedesktop.DisplayManager /org/freedesktop/DisplayManager/Seat0 org.freedesktop.DisplayManager.Seat.SwitchToGreeter
It’s demonstrated something interesting - if I invoke it from a terminal, the OS instead hangs without ever transitioning to the black screen: