The hand-written code solves problems. Many of those are problems about how to write code. In your world, these are apparently invalidated as problems now, due to becoming less profitable: by "problem" you mean "profitable problem". Is chasing after profitable problems noble and special, I don't know, it serves demand, demand matters somewhat, fine then. But it's not the epitome of problem-solving.
The hand-written code solves problems. Many of those are problems about how to write code.
But what is code for? I don't know that I think there's any inherent value to code for its own sake. Just like I don't think a tool's value can be separated from what you do with it.
I'm not sure where the "profitable" part comes from. I know lots of people who have vibe coded little apps that solve a problem for them or their friends and family. There's no profit involved, but it solved a problem.
Can you give an example of a problem worth solving for which there is truly no demand? I don't understand that, because to me it seems like the demand is what makes a problem a problem. Otherwise it's just a state of being, and if there is no demand to change, whether yours or anyone else's, what makes it a "problem"?
I was thinking of steam locomotive enthusiasts, actually. I mean, yes, if the future of coding is similar, it would be a pretty sad, farty old hobbyist world to be consigned to. But some people understand steam engines very well, and this isn't for anything except steam engines. You get a bunch of subtle side-benefits: generic problem-solving is transferable, which in this case isn't completely generic either because the general domain is engineering and physics. There's also the history angle. It's also just interesting: who knows what the benefit is? Many assorted inspirations may crop up from the stimulation, like with pure mathematics.
But it doesn't have to be so brutally outcome-based as you're demanding, although you do get a ride on a steam train out of it too.
It's not entirely unprofitable, either, if that matters. Niche.