Teaching is all about crossing the inferential distance between the student's current knowledge and the idea being taught. It's my impression that most people who say "you just have to practice," say as such because they don't know how to cross that gap.
When the specific inferential distance is really really small, people can cross it by doing. This is how things were invented for the first time. And repeating this discovery on your own can be a great feeling that gives you confidence and motivation. So it could be a good teachning technique to do this... as long as you have a sufficiently good model of your student, so you know what exactly is the "really small distance", and if you later check whether the new concept was understood correctly.
So I imagine that while some teachers may really use this as an excuse when they don't know how to teach, I would be charitable and say that a lot of them probably do not have correct understanding of how exactly this works (that very small inferential distances can be crossed easily, but large ones cannot), so they just try copying someone else's style and fail. Actually, sometimes they randomly succeed, because once in a while they have a student who happens to be really close to the new concept, and this prevents them from giving up their wrong ideas about teaching.
Most people believe very strongly that the best way to learn is to learn by doing. Particularly in the field of programming.
I have a different perspective. I see learning as very dependency based. Ie. there are a bunch of concepts you have to know. Think of them as nodes. These nodes have dependencies. As in you have to know A, B and C before you can learn D.
And so I'm always thinking about how to most efficiently traverse this graph of nodes. The efficient way to do it is to learn things in the proper order. For example, if you try to learn D without first understanding, say A and C, you'll struggle. I think that it'd be more efficient to identify your what your holes are (A and C) and address them first before trying to learn D.
I don't think that the "dive into a project" approach leads to an efficient traversal of this concept graph. That's not to say that it doesn't have its advantages. Here are some:
Side Notes: