Why the 20th-century explosion of styles/genres
Four major developments happened as the 20th century approached and developed through WWII:
- City-States gave way to the modern conception of Countries. Along with that, monarchies gave way to more democratic forms of rule.
- Because of the "softening" of border, and the development of communication and travel, it became easier for composers to explore formerly unfamiliar types of music.
- Among Western composers (and perhaps others, but my knowledge is limited to the West), there was a feeling that Tonality had run its course, and they were searching for new models for creating music.
- Especially in the wake of WWII, Western composers (again, within the limits of my experience) were specifically looking to reject the tenets, musically and morally, of earlier music.
All of these factors combined to give composers immense flexibility to experiment and seek new, idiosyncratic ways of creating and organizing music, pushing the boundaries of what could be considered music, and debating the underlying purpose of music.
Why the prior relative limitation of styles/genres
In earlier times, the conception of art, and what could be considered art, was more limited. There were specific aims toward "beauty" and "structure", and these were culturally defined on comparatively rigid terms.
In Western music, for many centuries, The Church gave strict guidelines for the parameters within which music could be created. The system which eventually emerged out of these strictures and traditions, Tonality, plus the pressures of fashion, status, and limited ability to absorb other musics, kept the genres relatively limited.
However, it is also the case, that differences between regional musics were more starkly defined. And what we now lump together as a sort of single "classical" genre, was, at the time, considered highly different musics. Sonatas, Oratorios, Chorales, Symphonies, many different types of dances, Masses, ... were all considered highly distinct, each adhering to certain conventions.
It's perhaps misleading to say that there are more different styles/genres today than "yesterday." While it may be true, there was still a plethora of differentiated musics historically. Historically, the styles/genres tended to be defined more by function and location, plus form; whereas, now genres are somewhat more defined by form, plus function and location.
So the number of styles/genres may be similar or different, but they are defined on different terms, and access to them is far more available now than "then".