if you are playing music, improvising, for example, you will find yourself obeying these rules naturally a lot of the time no doubt! (Unless you're going for that medieval style!) So in fact this is just in writing, what many people wouldn't think about...
There are other rules, for example in cadences (end of phrases)... You cannot double the 3rd of the triad in a major chord, the bass note must be the root position, and there are others... But again these rules follow what sounds good... For example... If you play a triad in the right hand with a triad in the left also, it will sound muddy, because notes low down the piano are harder to distinguish (physics geeks feel free to intervene) so, removing that major third in the left, giving chord I and V makes things sound much nicer.
So to answer your question, these rules are the standard convention for the classical and romantic period and it is in fact the breaking of these rules in the right ways that makes a composer great! So in the real world you're right, these rules can be broken or bent! But with care!!
If I've made any mistakes in this explanation guys please correct me!! Would be helpful to know!