So, it will probably always be true that there is a need for web developers, who can be well compensated. However, it will always be for people who need something that hasn't been automated yet. So, you have to be able to develop in something beyond standard html or wordpress, etc.
Another idea, and this is more speculative not something I've done personally, is to specialize in helping out organizations who have built a hairball of Wordpress plugins, which they now can neither maintain nor live without. In other words, assume they will try to live without a well paid web developer, and will only come to find you once that has not worked out, and they need rescuing. I believe there are a lot of organizations like that, and more being created all the time.
Lastly, the key is making sure that your customers are happy with you, so you need to be able to talk to people, and gently help them to better understand their own technological needs, rather than assuming they will come to you with a well defined problem. There are a lot of organizations that know they have a problem with their web presence, but don't know enough about that to understand exactly what to ask for; if you don't have patience or ability to help them sort that out then freelance is probably not for you.