He was a victim of his own success, like a lot of boxers with similar capabilities. He was knocking people out for fun, so he never bothered to address the serious flaws in his style.
Then he comes up against a tough son of a b in Salido, a guy who has not had the kind of red carpet treatment that Lopez had, who had to adjust his style to survive and then become successful, and he made Lopez miss and took advantage of that wide open defense.
Even then Lopez's talent nearly took him through it. He dropped Salido hard in the 2nd fight, but it was at the end of a round and Salido recovered.
There are very few boxers that continuously improved, adapt. Most just rinse, wash, repeat on what works well for them, and are befuddled when they get beaten.
I'd add that Lopez's flaws were there even before the Mtagwa fight - the lack of head movement, the inability to lead effectively, his tendency to initiate an exchange, even when at a disadvantage, just to get the counter right hook home & bugger the incoming 'cos I'm gonna knock you out!
It was just that as you said, the more guys he knocked out, the less he took notice of his own flaws & the more weight he put on doing damage himself.
He can come again, though. Look at Jhonny Gonzalez, I thought after being done by Nishioka it was the end for him (in fact, I thought it was the end for him after getting done by Vazquez & then again by Penalosa), so it can be done. Gonzalez has worked hard to fix his technical flaws whilst maintaining his best qualities. You need something proper inside you to do that, though. Time will tell if JML can do similar...