The general’s surprise downfall was the latest indication that even top lieutenants are at risk as Mr. Kim has rival agencies monitor one another to detect and punish any sign of disrespect or disloyalty.