I agree this should be exported by the flatpak package. I haven't hit any other
packages putting anything in /etc/profile.d, though that does happen I know (so
perhaps Guix should incorporate or patch such things?). Flatpak is also due for
an update soon I think, so that would be a good time to
Flatpak does export /etc/profile.d/flatpak.sh, that should set up
XDG_DATA_DIRS. But I don't think there's a canonical way of using it in guix.
Another way is to modify the package to do exactly what you said.
Applications installed by Flatpak can't be discovered by application launchers.
A fix to this is to add the directories '/var/lib/flatpak/exports/share' and
'$HOME/.local/share/flatpak/exports/share' to the search path set by the
XDG_DATA_DIRS environment variable.