What do the maintainers get for all of the work, stress, and abuse? Money? Maybe they’re lucky to get some sponsorship money but it’s not going to make them rich. What about recognition? Maybe but how much does the world care about GitHub stars? Their resume? Perhaps but there are more efficient ways to get lucrative software engineering jobs.
I would argue that the main motivation is selflessness. Developers want to help other developers. They want to contribute to the common good. What a beautiful thing.