To be fair, most of the later Mega Man games never sunk to the depths that the Sonic franchise went to. It was just a few bad Mega Man X games. The Zero and ZX series were really good, and Battle Network and Star Force had their run. Mega Man games weren't really "bad games" in the same way that Sonic games were; Sonic games didn't just suffer from poor design choices, they were also poorly made. Mega Man games were—at the very least—technically sound.
But yeah, the real problem Capcom has with Mega Man is that while the games are good, they're not blockbuster successful, and there's a big fragmentation in the franchise. They have Classic, X, Zero, ZX, Legends, Battle Network, and Star Force. The brand identity is so spread out that it actually affects how financially successful the line is. Mega Man is a lot of different things to a lot different people, and that makes it hard for a company to pin down what to do with it.