Second year student here. I consider a Phd to be "research apprenticeship". You should expect to experience the full life-cycle of research. "Writing code" is only one part of it.
In my case, "writing code" accounts for ~25% of my time. Much more time is spent running experiments, analysing results and publishing.