How did 19th century sunni leaders not subject to the Ottoman Empire justify their independence alongside an existent (presumable legitimate) Caliphate?

by Oedium
Labrydian

First thing to note, is that for most of the 19th century there were very few independent Sunni leaders. The Moroccans were independent for the first half of the 19th century before being colonized by the French and Spanish, but they were largely outside the Ottomans' sphere of influence already. The Barbary states (Algeria, Tunisia, etc) were an Ottoman buffer state, were allowed to choose their own Dey, and largely operated autonomously. When American and European shipping was being attacked by the corsairs, the Moroccan government even signed a treaty with America and declared American shipping was under its protection, showing their direct opposition to the Barbary states. Later, after the French took Algeria, Morocco was completely disconnected from even that link with the Ottomans.

I'm not familiar with how the Islamic African kingdoms south of Ottoman territory viewed them, unfortunately. Smaller principalities in the Gulf outside direct Ottoman control existed (Bahrain, Qatar and the UAE intermittently), but they were largely peripheral.

The main Sunni area that was not under Ottoman control was the Emirate in the central Arabian Peninsula - variously known as the Emirate of Jabal Shammar, Ha'il, or Rashidi Emirate. The leading Rashid family was in more or less constant struggle against the House of Sa'ud who they deposed and would eventually conquer them in return, and the Rashids tried to court Ottoman favor as leverage against the Saudis. As Ottoman power declined towards the end of the 19th century, the Saudis became more and more daring in their attacks on Rashidi territory, eventually taking Riyadh and uniting the Peninsula under Ibn Sa'ud, who was a Wahhabi who had no qualms about attacking Sharif Hussein ibn Ali in the Hejaz (Mecca and Medina), who claimed the title of Caliph at the time.

With all that said, I'd like to address something in the title: "Presumable legitimate" Caliphate. Caliph is a title with an interesting history whose importance varied depending on the political circumstances of those who claimed it - It's almost always been subordinate to the temporal titles the Ottomans held, especially so leading into the Tanzimat reforms where the Ottomans attempted to Westernize. The Edict of Gülhane in 1839 specifically established legal protections for all subjects, regardless of religion. The Reform Edict of 1856 further attempted to give equal status to non-Muslims. This process continued all the way until Atatürk's reforms with a brief interruption during Abdul Hamid II's reign, in which he attempted to use Islam as a unifying force in the empire to try and reverse the decay. Imperial instability and his (justified) fear of assassination belies the reality that his efforts were largely ineffective, however. Ultimately, the title of Caliph was very rarely a major factor in Ottoman policy, and when it was a factor, it was largely to the end of underlining and solidifying the Ottomans' temporal power.