I think the reality of rock and hip hop is a lot different than the more black and white image you paint. Though to be fair your panda lenses might be holding you back on that one.
Every genre is liable to transform in themes. Jazz was the music of the poor minorities, combining African rhythm and cheap brass instruments to make something that was completely new. Everyone's parents hated it and the ones associated with it were reefer-smoking freaks. Nowadays it's the music of old people for most of the world -- obvious exception to places where it remains a cultural constant like New Orleans. Same story with Rock and roll -- crazy new music adopting older aspects and cultures and generally looking ridiculous to parents. Though nowadays you'll be hard pressed to find a dad who isn't wearing awful jeans and listening to Led Zeppelin. Music simply changes and nothing, no matter how edgy and defining it was in it's prime, will be subject to exist in a vacuum. Fans age but retain their taste. Older people appreciate different genres for the first time. The point is that when you exist long enough you're going to have some different age groups appreciating you, and that goes true for rock and hip hop.
Anyway, as for why rock lost it's popularity, it's simple: self-aggrandizing douches who took themselves too seriously made rock a genre full of asswads and lameness. This was happening all the way back in the late 60s. You'd be blind to not see how rock split into enthusiasts of various aspects of it in the 70s and 80s. Heavy metal, punk -- you name it. By the 80s your straight-up "mainstream" rock was just party music, though this was true for the most part of the late-70s too. It's just more pronounced in the 80s because everyone began wearing make-up because... that's rebellious? No, it's because it was ridiculous and these groups had nothing to say beyond "let's get loaded and f*ck around" which is completely fine. It's just that people for one reason or another got tired of it and by the late 80s and early 90s more alternative genres were taking precedence. Grunge, sure, but also ska and hip-hop and breakbeat rave culture and industrial music and just alternative musicians in general. The 90s exploded with post-punk fury and after people proved you didn't have to conform to expectations of sh*tty guitar solos and wearing make-up [which is what rock was by the end of the 80s], people began to push the boundaries of music in various directions past just regular old rock.
That's ignoring a huge portion of music history, though. You could spend days talking about the evolution of music during and after the 1960s. As instruments got cheaper and more music rolled around, people began to get influenced by this and that, and then they rehashed or explored this theme or that theme in a different way. The availability of musical resources is what really changed how popular music worked, but those seeds were sowed decades before rock met it's supposed end.
At the end of the day I think it'd be a more interesting question to ask how the availability of instruments lead to the diversity we see in music today. Rock is an important genre but asking about only it ignores that it wasn't birthed in a cultural vacuum -- it's got its roots in blues music and just like any other genre it is born of young people getting together to play rhythms and maybe do things to each others bodies. It existed right alongside jazz and folk golden eras. It's a mainstay of music but that doesn't mean it's the best kind or the only kind. Still, it transformed to meet the needs of several generations. That's why nowadays something as ambiguous as "classic rock" can mean everything from British Invasions to Heartland ballads to Psychedelics and Funk to Make-up clad clowns to -- oddly enough, grunge. For that reason I don't think it being on the pop charts matters too much. Maybe it's seen its heydey and other genres will be more relevant from now on. That doesn't negate its influences or mean that no more rock music will be made. Nor does it mean it's more important than hip-hop or electronic music.