I think of musical rules as being like rules of the road, but not legal rules, like basic rules of driving. "Leave adequate space for braking" and such, and how to negotiate merges. But these guidelines are just there to help me get where I'm going in one piece, and are immediately overridden by any situational factors. I'm not going to yield to somebody going dangerously slow because it might create a general hazard, I will accelerate past them, and if I'm on a Christmas "light ride" I will disregard a lifetime of habit and turn my headlights off at night.

Imagine a musical "rule" that says, "Don't play a song in two different keys at once". It makes sense because of the dissonance that will cause. A bi-tonal piece will quite likely sound awful, and a beginner would be well-advised to have all his players playing in the same key.

Of course, if you're Charles Ives, you will do what you want and in fact that will often be EXACTLY what you want, and "rules" do not stop you.

The beginning composer, however, is advised not to unintentionally come off sounding like Charles Ives when that was not desired.