Also a willingness to consult (be a contractor) and/or relocate to where the best jobs are. Not everything is Zoom-able. Programming, in theory, can be done anywhere, but in practice that's not true, especially for old-school jobs where skillfully interacting in the (technical, people, etc) environment can be more than 50% of the actual job.
In the U.S., sometimes those jobs are in silicon valley or New York, but sometimes it's Omaha or Charlotte.
If you are mobile or even slightly mobile, make a list of places you are willing to relocate to and then pursue those roles. If you're willing to travel internationally, even better. Most of the limiting factors that make you say "oh, I'd never want to live there" can be assuaged by saying, ".. unless I was making enough money and it wasn't going to be forever."
The combination of willingness to travel and experience/skills in something really esoteric is a rare-enough combination that you'll always have a good job, even in a recession, and often you'll have your choice of excellent jobs.
Like your point, this definitely applies for plumbers, too; it's really hard to do highly paid plumbing gigs in Tokyo or NYC over Zoom.
Remember, unlike most startups, with consulting or jobs, you only have to sell one product: you. So, how unusual the need is doesn't matter. There might be only one job in the world for that. What matters is that you are one of the very few people who can fill that need. When it comes to consulting, niche thyself.