I would agree except...
It's just as likely the first programming experience many ever had was building and programming a Lego robot (Mindstorms).
While the general term "game" can define a category so huge as to encompass almost all of programming, when used in the context of the original poster it always seems to mean "writing Doom style games".
As has been stated here before - the best way to learn programming is to have something you really want that requires a program. That is - learn programming by writing the program you want.
One of my first Windows programs was a MIDI controller program, because I really wanted a MIDI controller program, and Windows seemed the perfect fit (sliders, buttons, SDK support for MIDI, etc.). I learned a ton about Windows programming (this was back in the Win 3.1 days) from that program.
I've never been partial to game programming for the reasons mentioned here as well - I don't draw all that well, so any game I make will have poorer graphics that those of an artist. I want to learn to program, not to manage a "game building team" (laudable but totally different exercise).
In the end I quite disagree with the teacher's statement. The best way to learn programming is to write the program you really want.