Without checking, I would guess that chords (or tone arrangements) generally considered dissonant arose from combinations of melodic lines. The composers (or performers) who generated the music decided that a good melodic line trumped a good harmonic sound.
One sees something similar in the common practice period. Moving bass lines (like a walking bass) often "ignore" the surrounding harmony to move melodically to a scale tone. (One can play C-G-A-B-C against a C major chord without causing too much havoc.) Similarly for melodic lines.
Dissonance isn't "bad sounding" nor "antii-harmonic"; it merely signals the "desire" (or raises the expectation from previous association) of movement. Dissonance also makes the dissonant note (or note cluster) stand out and can be use to highlight a part (instead of just playing a note louder. It adds a sort of accent that is different from (though can work well with) syncopation, loudness, change of register or instrumentation, etc.