You're misunderstanding Stannis's base motivations. He believes he is entitled to be King and that he is the rightful heir, because he is. Tommen is bastard-born and lacks any of the blood that the Baratheon claim was built upon. Stannis is a man of law and justice. In his narrow interpretation of that law, he not only should be king, he must be king.
Neither the Baratheon's nor the Lannister's are the rightful heirs. Baratheon claimed the throne only after taking it from the Targaryens. They are all pretenders.
The whole point of this story, inspired by the Yorks and Lancasters, is that the divine right of kings is bullshit. At this point there is no rightful ruler and, like in England, it will only be the most ruthless who take the throne and then write the history of the kingdom in their favor.
Robert won the throne by conquest, which was always a legitimate tactic in medieval Europe. He used his matrilineal descent from the Targaryans as an excuse, but his crown truly rested on the death of Rhaegar on the Trident and the death of Aerys by the Kingslayer, and was propped up by the victorious armies in the field and the gold from Casterly Rock.
Technically, after Robert was established in his rule, Viserys became a pretender. (Think the Glorious Revolution. James II fled the oncoming William III, and though he claimed to be the rightful king, history remembers him and his sons as pretenders, simply because they never regained their throne.)
The bigger question now is who is left as an heir? Tommen obviously has no children, and neither does his sister Myrcella. Should they both die, or their illegitimacy be proven, that leaves Stannis as proper heir to Robert. As we saw last weekend, he no longer has an heir, so he would be a temporary solution at best, unless he remarries and has a son. After Stannis, the only remaining heir is Dany, who has been informed by a semi-reliable source that she is barren. The future of the Iron Throne looks rather unstable...