That still doesn’t make sense. Robert takes the throne in 283 AC, but Joffrey isn’t born until 286 AC. So for those three years, Stannis and Renly are Robert’s heirs and by custom and tradition would respectively be Princes of Dragonstone and Summerhall. Even afterward, they remain in the line of succession.