Libya is not America. Qaddafi facilitated an environment of distrust, and nepotism within his country that resulted in powerful factions forming against him. Hafftar always had a secret army in Libya, Al Qaida was always in Libya, and of course foreign state actors were also in Libya. It was a perfect storm. Qaddafi's military was a joke, no combat unit ever went past a battalion sized level because Qaddafi feared a coup so much (and he was a COL, and he had some kinda weird socialist fetish with that). Standard of living and religion were not the problem, it was people wanting power. Qaddafi protected himself using specific praetorian guard units like the 32nd Khamis Brigade (headed by his son), and Jamihiriya revolutionary guard (people hand picked from his tribe). He put loyalty over efficiency. People in his country got jealous.