I only modify a small number of sites that I regularly visit and so far I’ve only once come across a site with random class names and IDs (I’m guessing that’s done as a way to defeat what we’re talking about). If I remember correctly, I got around the random name problem by removing the parent element which had a defined name.
I don’t visit Twitter and certainly never tried to do anything as sophisticated as what you’re describing (though it sounds like other users on this page would benefit from your userscript). I just make the sites that I regularly visit that bit easier on the eye without spending too much effort on modifying styles (I also haven’t done web development in the last 10-15 years so delving into scripts and the DOM wouldn’t be my forté).