Because some of those devices are cheap and sell (see the Kindle Fire as one example - massive sales, really not great - and yes I know it's a fork but it's still Android at it's heart).
Does that make Android crap? Obviously not but it does mean that there a hundreds of thousands, if not millions of people who have that perception (and are right because for them it has been crap).
Excluding the crap ones is no more a representative picture of things than excluding the good ones would be. Android is the sum total of all devices running with all the good (huge numbers, some great devices out there) and bad (fragmentation and massive variation in quality) that that entails.
"You're probably correct but then, why judge the Android OS as a whole based on the fact that there are a few rubbish devices out that run it?"
Because this is how Brands work. You don't get to say Android-Google and Android-Samsung unless you're talking to an analyst or a geek. For most Android owners, they have an "Android" phone. What brand? Uhh I dunno Google? Android?
Android as a brand is the collection of not just the superstar devices, but the shitty POS devices as a whole.
So as a brand, iOS > Android because the average of Android is weighed down by the crappy side of Cheap Android.
That doesn't mean that any one device is superior to any other one device, but rather that as a collective brand, the iOS brand is superior to Androids, and if you blindly buy an iOS device you're more likely to get quality than if you blindly buy an Android device.