I'm in my 40s. I have fond memories of HO railroading with my dad when I was younger, and now that we've moved into a house with a sufficient basement, I've started on a layout to share with my son. (Who am I kidding, it's for me as well). He's only 4, but into trains in a major way. I suppose we have Thomas to thank for that, but he was using terms like "shunting", "ballast", "junctions", and "sidings" when he was 3, and was using them correctly. He gets a big kick out of riding real trains as well. My FIL is also into O-gauge trains, so model trains, train museums, and RL trains are big in our family all around.
I do think there's a natural age gap for many people. Many of us got into trains when we were young. But as you get older, your interests broaden, and once you are independent, there's often some time before you can re-engage. I think back to when I was in my 20s, in a tiny apartment of my own, and working hard to pay the rent. I didn't have anywhere near the time, nor the space, to engage in the hobby. Even now that I have the space, I still only have limited time, due to work and family commitments. I've been working on this layout since we moved over a year ago, and it's still very much an early work in progress. Some weeks I have maybe an hour or so to work on it, some weeks none at all. And when our 4-year old "helps" me, I get maybe 5-10 minutes of actual work done on the layout in that hour.
But I'm patient, and it's enjoyable just to work on the layout. If it takes a few years to finish, that's fine by me. However, it's definitely made me appreciate that not being retired, and having young kids, places a hard cap on the amount of time I can spend on the hobby.
In short, not having a huge number of 20-30 year olds in the hobby may not be a reflection of waning interest, but simply reflecting where people are in life at that time.