I don't think you need to write the code to develop a deep mental model of what's going on, but you do need to think about it a lot and intensely to develop that model and coding forces you to slow down, spend a lot of time thinking about the problem, and generally trying out different ways of looking at it.
Coding in this way is like having a personal Socrates to help walk you through the problem and achieve enlightenment.