G2 did have a weak start for reasons that you mentioned, but some of the later G2 toys were actually really good. I often say that Beast Wars popularised and standardised a lot of contemporary standards in Transformers toys today (e.g. articulated robot modes), but it was really Middle to Late G2 that pioneered these things.

The poor cartoon didn't help, but even if the cartoon were good it may not have been enough to save G2. After all, the G1 cartoon was more faithful to the general aesthetics of the toys but it failed during Middle G1 (and the Japanese anime series barely scraped into Late G1). But ultimately a good toy line will sell itself, even if the show is terrible or even non-existent. Robots in Disguise (2001) is a good example of this. Those toys hit shelves here months before the show aired, but the toys immediately flew off shelves. And the RiD2001 cartoon wasn't the greatest; it was good for its target audience, which was clearly a very young audience, but it held little appeal to anyone over the age of 10. But everyone still loved the toys, including adult collectors! And we know that this line inspired Takara to create Binaltech and Masterpiece. I mean, does anyone really care that Speedbreaker has a weird fetish for red sports cars, or do they care more about the fact that he's a really great looking licensed Dodge Viper that transforms into a detailed and articulated robot? I'd say that people care more about the toy than the character.

Both G1 and BW came out before their respective shows aired, and those lines still sold really well prior to the support of the show. Initial G1 sales hit the US$1.4 million mark (US$3.2 million or or AU$4.5 million by today's standards). While G2 was a practically dead toy line by the mid-1990s, when BW came out, Transformers climbed to being the third top selling action figure line in the US (after Toy Story and Star Wars). So by the time their cartoon series came out, these toy lines were already selling strongly. The best story-telling in the world won't sell a bad toy. Supreme Cheetor is a good example of this. BM Cheetor was actually one of the better (I'd say best) written characters in the TV show. He went on a very clear and logical journey as a character, which he had begun in Beast Wars, and matured in Beast Machines. It was actually really good. But boy did Supreme Cheetor supremely suck as a toy. That figure shelfwarmed for yeeeaaars, especially at TRU who refused to discount the sucker. G1 Hubcap on the other hand was a popular toy despite having ZERO appearance in media (cartoon, comics etc.), yet toys like Warpath and Wheelie were pegwarmers (I personally like Warpath, but yeah, he was never a hard toy to find in stores!. Kup appeared prominently in the cartoon and comics, yet he was the worst shelfwarmer in 1986. It was either Target or Grace Bros who discounted Kup to $5 just to move dead stock (and my mother literally bought a trolley-full of Kups which became gift-fodder for all relos and friends for the next year... every birthday and that Xmas... here, have a Kup - I ended up having two Kups for myself because we ended up with a surplus Kup! I put the Autobot logo on the chest of the spare Kup to make it more media-accurate while the other only had it on his legs to maintain toy accuracy ).

Yes, the G2 comics were violent... but that wouldn't have turned kids off. Remember that Robocop had merchandise marketed at kids in the late 80s and 90s. Unthinkable these days! Also, the G1 comics were violent too. #1's cover shows Optimus Prime crushing a jet in his right hand! If that's a Decepticon, then he's dead... the very first page which shows a battle on Cybertron also shows a generic Autobot crushing a Decepticon in his hand. And while the G1 cartoon never showed any fatalities until the 1986 Movie, the G1 comics showed fatalities from quite early on. The comics always ensured that the Cybertronian war was always portrayed as a consequential war. So this level of violence was nothing new to G2. And don't forget that a lot of Transformers fans who were kids during G1 were now teenagers during G2. Yes, it was important for G2 to attract new kids into the franchise, but you didn't want to isolate the original fans either. This is another area where BW succeeded.

Speaking of which, BW was an incredibly violent show (just ask Waspinator) and yet it proved popular with audiences. TF Prime also killed off Cliffjumper within the first episode, and the re-death of Zombiejumper was pretty gruesome. Transformers has always been able to get away with higher levels of violence because the characters are robots. You can show machines being blown up, just not people or animals. But the concern was there from the beginning. In its native Canada, the BW cartoon was actually called "Beasties" because censors didn't want the word "Wars" in a kids' cartoon. So I guess the Star Wars cartoons must be called Starries there.