In 1998, Windows-98 used to run with as little as 16MB of RAM, whereas today even a lighter distro such as Xubuntu consumes at least 250MB at rest. So what's going on here? Rapid expansion of operating and storage technology, that's what.
A 16x16 pixel icon in 256 colours needs 256 bytes...I think that was the standard in win98 times. A 32 x 32 icon in truecolour needs 4kb...that's 16 times...
A fullscreen picture for 800x600 in truecolour needs 1.8 Mb (without alpha 1.4mb), a fullscreen picture 1920x1080 needs 8mb (without alpha 6mb), 4 times the size...
A simple 16x16 bitmaps for a letter (non anti-aliased, single colour..so not that useful in realitly...but still useful to demonstrate the differences to back then) needs 32 bytes. So a full set of letters for 256 ascii characters (ignoring control chars) needs 8kb. Approximate current number of letters in unicode...135000...so for a full set...about 4mb. (But really just meant as example for the difference is data size we face nowadays...almost nobody uses bitmap fonts anymore)
What I try to say is that sure, code got more complex and we probably waste a bit on it as well....but compared to the data payload changes we had in the last 20 years it's negligible. You have no problem running a linux text only interface in less than 16mb even nowadays...still done in plenty of embedded devices. But you can not compare any gui interface with back then...the background picture you probably use right now alone uses up more memory than the whole OS back then. And we have large screen sizes nowadays...somewhere the memory to keep your windows buffered has to come from.
And that is even completely ignoring modern UI practices like having "responsive" interfaces with animations where all animation phases of buttons have to be kept in memory all the time to react quickly if the mouse hovers something.
I for sure don't want to defend stuff like electron apps nowadays...there are plenty of really wasterful ways to use resources. But even if we would use the exact same techniques and same code as 20 years ago we still would get in the memory dimensions we are right now with "light" DEs simply because the data they have to work with are in those dimensions.
It's just that RAM is not as scarce as it used to be and applications have evolved to take advantage of it. Software is designed to keep more stuff (e.g. libraries, icons, sounds etc) in memory for speed nowadays. Switching to 64-bit is also part of it, 64-bit code simply occupies more memory.