In Game of Thrones season 8 the audience comes to the realization that Jon Snow is no bastard, he's Aegon Targaryen and he's the heir to the Iron Throne. And in the finale we see Jon murder Daenerys probably because of Tyrion's pep talk, especially when he says:
Do you think I'm the last man she'll execute?
because Daenerys is scared of Jon becoming the King.
One can say that's why he was scared of being killed. But isn't the righteousness of Jon and the fear of Daenerys becoming a tyrant enough to do that? Was the heredity plot necessary at all?