That is a good discovery.
It's probably one of the better ways to detect the running desktop environment as the user might have multiple environments installed and just uses one of them currently, as such looking for installed things doesn't work reliable.
And looking for env variables can be unreliable.
And scanning the dbug might not be that use-full either.
But I'm not sure what they use that for. (Notification daemon selection? But that wouldn't be that reliable either, theaming? I dubt it.)
But I guess even if it's just for telemetry it would be a reasonable thing to do.