When she legitimised Gendry, Daenerys had not won the Iron Throne.

>! She died before her coronation

and Gendry was at the Great Council before

>! Bran was crowned King.

How was Gendry able to become Lord of Storm's End?