Are we using the same ChatGPT?
It cannot write a full app, but that is a matter of context size.
It absolutely can "reason" within bounds, attention is a much more powerful system than you realize.
Chain-of-Thought is a well-established technique for LLM prompting which can produce great results. And the snippets of code GPT-4 generates for me are usually on point, at least they were until OpenAI dumbed the model down in the last few months with GPT-4-Turbo.
I get it not only to write novel code, but explain existing code all the time and it reasons about my code very well.