Obviously, yes. For the exact same reason it's true for math homework, too!
Most code most people write is trivial in terms of semantics/algorithms. The hard bit is navigating the space of possible solutions: remembering all the APIs you need at the moment - right bits of the standard library, right bits of your codebase, right bits of third-party dependencies - and holding pieces you need in your head while you assemble some flow of data, transforming it between API boundaries as needed. I'm totally fine letting the AI do that - this kind of work is a waste of brain cycles, and it's much easier to follow and verify than to write from scratch.
When I’m writing code, I often switch between an high-level mental description and the code itself. It’s not a one way interaction. The more I code, the more refined my mental solution becomes until they merge together. I don’t need to hold everything in my memory (which is why there are many browser tabs opened). The invariant is that I can hand over my work any time and describe the rest of my solution. And the other advantage is the growing expertise in the tech.