Sure, composing by rules can help you learn music. If there is any one method that I think is useful for learning music, it would be the 12-tone serial method. It's great for learning intervals, and it's great for helping one gain a better understanding of harmony. It also forces you to concentrate more on the rhythm of a piece.
It is a learning method. Most of the "how to compose" type theory books establish all these rules, because they teach learning methods, not how to compose. All these methods are trying to teach the same thing.. the relationship between notes. The problem is, the older methods take a lot of the self learning and experimentation out by making certain combinations of notes taboo.
Course, learning by the serial method does not mean that all the shit you make after that is going to be atonal beepity boop stuff. It just helps give you a larger musical vocabulary. You can make music that is completely tonal, but elements of the more complex(or to be less pretentious, unorthodox) harmonies that you know will creep in.
Either way, there comes a point where you have to break away from the method or discipline, and start composing from the soul, where it just comes out naturally and without much though.. You have to reach a point to where composition comes from the subconscious.
Then again, I could just be getting overly romantic and pretentious about it. Don't mind me, I'm just a crazy drunken fool who couldn't compose his way out of a paper bag.