so you can do a lightweight desktop based on Ubuntu.

Honestly, I suspect the main issue here is Gnome.

Despite their insistence on ‘simplicity’ and ‘elegance’, Gnome is by far the most resource-hungry DE that exists in the Linux ecosystem.

That, and maybe snap packages. It can’t be good for RAM usage to have every app trying to load its own independent system of dependencies. That’s got to lead to a lot of duplication in dependencies loaded into RAM.