The evolutionary origin is alleged to be recent: Other animals do not have a preference for dissonance and consonance. (McDermott & Hauser, 2004).
Humans have new auditory regions in the brain for predicting and processing speech, and processing the emotions conveyed in the voice. The human voice mostly has harmonics in the 3rd and 4th note due to the properties of the vocal tract. There have been some basic studies of the 12 notes of the piano as represented in the human voice, which concluded that the "consonant" sounds from chords and melodies correspond to the the sound of the human voice.
This article suggests that dissonant/amusical frequencies are uncommon in natural ecology, because of the way physical objects resonate. Bird melodies are atonal and not particularly dissonant or consonant.
Some people may suggest that animal alarm calls are more dissonant than mating calls, especially those that are made to scare you like a cat hiss, a gecko scream, baby marmots which are separated from their mother, a rabbit being eaten.
Actually, many studies have identified brain regions used for emotional processing, the same that react when they see a beautiful or unnerving image, by MRI tomography and also from people who have had strokes which make them non-reactive to music, and people with amusia known as amusics.
found an increase in frontal-midline (Fm) theta power
for consonant music, indicating greater coherence of
neural firing in certain population of neurons. This is
interpreted as reflecting activation in the anterior cingulate cortex (ACC), which has been implicated elsewhere in processing pleasant music (Blood & Zatorre
2001). The ACC’s role in emotion is also supported by
its inputs from other key emotion-related areas, such as
the amygdala, hippocampus, and parahippocampal gyrus (Devinsky, Morrell, & Vogt, 1995).
There are a lot of studies on the topic, this is a well written summary of recent research.
Musical sensory stimulation is a fascinating topic with complex ecology and brain quirks, it's best to research the topic individually to find which aspects of music do what to the brain:
Music rhythms vs cardio/breathing/cerebral rhythms, individual sound consonance/dissonance, and complex auditive patterning of sounds found in rhythmic chords and melodies. The conflict-resolution of harmonies are what you are referring to regarding the sequence of notes, there are studies on musical expectation, it's a sub-field of consonance/dissonance neuroscience.