You're right that being a scientist is unlikely to result in personal wealth and so that's not the primary drive for those who seek faculty or research positions. However, it's not just curiosity, prestige and vanity either, because a big factor for promotion and tenure is how much grant money you bring in. That money is what keeps the university's lights on and buys the lab equipment and pays the grad students, so it's still money as a primary driver in the background.
My dad said he stopped being a professor because of that.
He liked the research, and he even liked teaching, but he absolutely hated having to constantly try and find grant money. He said he ended up seeing everyone as "potential funders" and less like "people" because his job kind of depended on it, and it ended up burning him out. He lasted four years and went into engineering.
I don't know that "motivation" is the right word for it, because I don't think professors like having to find grant money all the time. I think most people who get PhDs and try to go to academia do it for a genuine love for the subject, and they find the grant-searching to be a necessary evil part of the job; it's more "survival" than regular motivation, though I am admittedly splitting hairs here.