This is an excerpt from a dialogue with a psychologist Elizabeth Brondolo, PhD in APA(Link is here; https://www.apa.org/research/action/speaking-of-psychology/stress-health):
"So when people face discrimination it changes the way their expectations about the way other people are going to treat them."
I believe the object of the verb;changes is 'their expectations about ~ treat them.'
Then what does 'the way' that comes right after 'changes' function here in terms of grammar? Is it an adverb? If it is, for what?