Agreed, the mind is running a predictive model as we listen to music. The structure and the deviation from structure all play into our mental model of anticipation and emotional response. Some of it is intentional and part of the composition but some is part of the experience that a live musician can impart in their music.
https://www.frontiersin.org/articles/10.3389/fpsyg.2014.0111... https://www.nature.com/articles/s41583-022-00578-5