Knowing how to code is a great skill, not just for practical purposes, but it's also just really cool. Even if AI replaces us and starts doing all code for us, we can still do it, if nothing else, just for fun.
Answering a question more related to the market value of knowing how to code, I'd say it's still an amazing time. I don't think we'll have any AI replacing programmers any time soon. We might, within 10 years or something (the sort of timeline where it's really anyone's guess and impossible to predict) but definitely not right now or in any forseable future. AI right now is a great tool that will just help you be a better coder than without it.
Think about it as a co-pilot (which is exactly what the really useful one from github is called). It is your side kick. It help you be more productive and it does things for you. But the one thing it can't do and won't be able to for a long time is to know what to do. It might now how, but not what. Programmers will be the ones guiding the AIs for a long time in this field.
Also, bare in mind that chatgpt generated code, which seems to fit into your description is only really useful in very specific small scenarios. It's great for initial prototyping and to give you a quick snippet of code that can (if all goes well) solve a problem that fits within it's prompt and answer constraints. On any real world code base, with several files and thousands of lines of code it's just pretty much useless. However, github co-pilot is not. It's amazing, but as I said, it help you do what you already want to do, it has no wants of its own, and it's not layman friendly, you still need to know how to program to make any real use of it, and it will continue to be so for a long time.
I'll give you 2 real world examples:
  • I wanted to build a new API for a somewhat hobby project. I've done it quite a few times from scratch but there's always a bunch of setting up and syntax and whatnot that you just don't remember exactly. Historically I'd have to go on google, find some examples and adap to what I wanted, or also go through a bunch of documentation and tutorials, and be doing a new google search with a different question every minute. With ChatGPT I described the various database models I needed, I asked for a bunch of other components to be generated. It did it all in a few minutes. It would've taken me multiple hours to build the same thing. Now, once it was generated it was all me, and chat gpt is useless from then on. It saved me a bunch of time creating a template but it was really only the first hundred lines or so. The remaining multiple thousand since, I had to know what I was doing.
  • On my main job we use github copilot, and damn. The more you learn how to guide it the better it gets. Multiple times I just start writting something and it immediately suggests the following 10 lines of code, which seemingly by magic are exactly what I wanted to do. But... even better, because it's solving for edge cases I didn't think about!
Once again. They're tools. You're the pilot. They help you be more productive. They can't replace you since they have no idea what needs to be done.