what's happening is that everyone is advancing to middle manager/product owner. to them, code that works is better than code that doesn't, even if the reason it doesn't work is that the developer is taking care that it works right. if you enjoy management and spec-writing, you'll be fine. if you care at all about the process of building software, you are just not going to enjoy the coming few years. there is nothing i can say to help.
if you want your skills to stay fresh, you need to the stuff you actually enjoy outside of work, at least a little. think of it like any hobby that you spend a few hours on every week. i'm trying to pivot to that by looking for jobs outside the software field.