Too late for OP, but adding for anyone else coming in from search engines.
NOTE: I am on Fedora and didn't test this on Ubuntu, so there may be some adjustments / additional work needed but I believe the broad strokes should be close. Please consider this as notes and anyone is of course, welcome to use them as a stepping stone to a better answer. In particular, I think I read something that Ubuntu uses snaps for some of the components of Gnome these days. I don't use Ubuntu or snaps and refuse to consider snaps while the backend remains proprietary. The paths I mention are relative to native installs on Fedora but if Ubuntu could have different package names or if it uses snaps for any of them, then the paths I mention may be relative to some snap-specific file path such as something under /var/lib/snapd or similar. My answer also ONLY considers lightdm - I did not test with gdm or any of the others.
Question 1: In /usr/share/xsessions/, I only have xfce.desktop and xubuntu.desktop, while in the DE list I have the above plus GNOME and Ubuntu on Wayland. How can I get rid of these?
On Fedora 38 Cinnamon, I had installed several additional DE's such as the 'Fedora Workstation' (Gnome), KDE, and Xfce using the dnf group list and dnf group install <name> commands. I later decided I didn't want Gnome or KDE, just Cinnamon and Xfce. Like OP, I started with removing the desktop shortcut under /usr/share/xsessions. But rather than just deleting the file, I did a reverse lookup (e.g. sudo dnf provides /usr/share/xsessions/gnome-xorg.desktop) to find which package the file belonged to and removed it the "right way" so that future package updates didn't reinstall the little bugger. This page indicates that the Debian/apt equivalent of sudo dnf provides <filepath> is sudo dpkg -S <filepath>. On Fedora, the gnome-session-xsession package was associated with this file and I removed it (e.g. sudo dnf remove gnome-session-xsession)
However, this did not get rid of my Gnome entries in lightdm. I later realized that there was also a file /usr/bin/gnome-session and associated package gnome-session. After removing this as well (e.g. sudo dnf remove gnome-session), when I logged out again, lightdm had finally removed the Gnome entries from the desktop environment selector.
In Fedora, some "spins" (equivalent to Ubuntu "flavors"), have also begun to remove support for X11 - this has already happened for our Sway spin, there is discussion that our KDE spin might remove support for X11 sometime in the near future, and rumors that this will eventually happen for the default Fedora Workstation (e.g. Gnome spin) as well. Right now, I believe the gnome-session package handles sessions for both wayland and x11 but if that ever were to change, it might also be worth knowing that there is a /usr/share/wayland-sessions folder that roughly corresponds to /usr/share/xsessions so that you could do a reverse lookup of any desktop files in that folder.
Last, I'm not sure why it would behave this way, but I had Xfce installed since the beginning but while I had the Gnome entries present it would not appear in lightdm, even after uninstall/reinstall of the virtual package group + rebooting. Interestingly, after I was able to successfully remove my Gnome entries from lightdm, the Xfce entry started displaying again without any additional work.
Question 2: If I reinstall, say, kubuntu-desktop (which I would like try out), Kubuntu Session does not reappear in the DE list. How do I make these show again?
If someone can into this and they weren't lucky enough to have it start appearing again after Gnome entries disappeared (as I saw for Xfce), my advice would be to try:
- uninstall/reinstall of the DE virtual package + logout. if that doesn't do it then
- reverse lookup packages for the files
/usr/bin/plasma_session, /usr/share/wayland-sessions/plasma.desktop, and /usr/share/xsessions/plasmax11.desktop and try manually installing or uninstalling/reinstalling those packages and see if has an effect.
for question 1, see also:
How can I remove the "GNOME desktop environment" entry from my login screen after uninstalling GNOME?