I first realized what I was doing when I was learning how to write Win16 programs in C after quite a few years doing them for DOS. After three or four programs (projects), I setup a skeleton program to give me a head start every time I started a new one. Then I noticed repetitive code to do things like colour dialog box controls (e.g. for a splash screen), or handling DDE. After I created include files and libraries for that, I realized this was because I had taught myself modular programming.
You need the bad experiences to know why it is A Good Thing. But you need to have then developed your own systems to know How To Do It. And then you need several different environments and/or languages so you get to Do It A Different Way. Only then are you ready to work with Someone Else's Idea Of Modularity. :-)
Wade.