>>120661i do think it is ungrammatical or at least borders on it, yes
when you use a pronoun like "it", that's supposed to point to an antecedent that is already in context, but op is referring to something that won't appear until the end of the sentence
and while "it" isn't yet known, "does" comes in to refer to a previous verb (realize) but the reader is still trying to figure out what "it" is supposed to mean, and then it would appear that "it" (every time generic music plays) is what the brain is doing, which would be nonsensical
"realize" is a weird choice as well because the brain is stated to be doing this unconsciously yet realizations/awareness are a conscious experience by definition
a clearer way to put it would be "every time generic music plays your brain picks up on it, even if you don't"