The actual harmonic rules employed today in all kinds of western music, especially as they relate to musical notation and the physical layouts (the UI so to speak) of various western musical instruments, have as much to do with the evolution of music theory as with the physical behavior of sound waves and human perception thereof.
Case in point, the layout of white and black keys on the keyboard: the disposition of white and black keys has more to do with the theory of hexachords developed in the 12th century. The hexachord system used to notate and transmit music was originally comprised of three overlapping hexachords, each including 6 notes (ut-re-mi-fa-sol-la) , which together cover in total 8 notes to the octave: The natural hexachord C D E F G A, the soft (molle) hexachord F G A Bb C D, and the hard (durum) hexachord G A B C D E. I should add that this system was superimposed on the greek modes of gregorian chant, made of two tetrachords for 7 notes to the octave.
So the soft hexachord starts on fa - the fourth tone of the natural hexachord, and the hard hexachord starts on sol - the fifth tone of the natural hexachord. And if you you play a melody and you want to go to Bb - the B flat (B-molle / bémol) is actually a fa on the soft hexachord. Likewise, a B natural (B-durum - bécarre) would be a mi on the hard hexachord. The terms bémol and bécarre (Bb and B natural) actually derive from the soft and hard hexachords (soft - round, hard - square). So the Bb was in fact the first "black" key (although some of the earliest keyboards have 8 "white" keys to the octave, with the Bb looking just like its neighbors).
Later, from the 14th century on, as music changed, more hexachords were introduced starting at different places on the natural hexachord, for more harmonic complexity. Along with those hexachords, more "black" keys were introduced. Actually some baroque keyboards include more than 12 keys to the octave, for use with meantone tuning: they would have split "black" keys in order to play the fa or mi of the note, for example Eb or D#, which in meantone tuning are not equivalent. But as composers and keyboardists started exploring both equal temperament and irregular temperaments, those distinctions were lost.
The modern keyboard with its 7 white keys and 5 black keys is rather a consequence of the evolution of western music over long centuries, not of any kind of absolute natural phenomenon.