There is an economist named Peter Zeihan who covers this is pretty significant depth. He's a muppet who had one good idea ever and then proceeded to be wrong about everything Russian/Ukraine afterwards, but it was a really good observation:
I'll sum it up for you, but feel free to watch the whole thing. Basically every historic military invasion of Russia has come through one of a small handful of terrain gaps that deeply inform Russian military planning. Ukraine is one of those gaps (good blitzkrieging terrain for the most part). Russian military planners and historians (like our boy Putey) are deeply aware of this. So it's deeply ingrained in Russian planning philosophy that Ukraine, Belarus, and the Balkans absolutely must be at minimum client states to act as a buffer towards aggressors. In this case, Nato. Which, whether we find it ridiculous or not, some Russian thinkers see as a direct existential threat.
As you mentioned, Russia has a demographic time bomb about to go off (honestly, a ton of countries around the world do...slight tangent...this is probably one of the biggest reasons to pump UBI's tires, it will increase local birth rates, potentially by a lot.) In Russian military planning circles, apparently this generation that they're currently sacrificing in Ukraine is the last generation where they expect excess male population of the right age to be available for this type of adventure. Basically it was no or never.