In a way it's not so different from learning in school. There were definitely times I read a textbook for a programming or other CS course and reused some example code or whatever to solve homework problems.
I think the helpful part is taking something that already exists, learning how it works, and rewriting it yourself to internalize it.
Again as usual the more important thing is that you know what you're using otherwise it's just copying.
It is different from before. The programmers are used to read the code of smart or creative people, or the code of knolled people working for years to solve a specific problem, and within this process they analyze and learn to improve, thanks to this self-learning path, eureka moments included. This process includes to search (to read the voice of different perspectives and knowledges, to learn to use critical thinking).
Now is being proposed to read LLMs' slope and unrevised code constructed from statistics as the way to learn? This is a big mistake. IMHO.
I think the helpful part is taking something that already exists, learning how it works, and rewriting it yourself to internalize it.
Again as usual the more important thing is that you know what you're using otherwise it's just copying.