First option-Jagiellon line continues-in theory Poland was elective monarchy even under Jagiellons, but in fact it is unlikely that any candidate from other dynasty would get the crown as long as there are Jagiellons around. The same could be done with Vasas-they were seen as continuation of Jagiellons, election of Vasa candidate was only formality as long as there were male heirs around. If John Casimir has a surviving son (he had short living son John Sigismund IOTL, just make him survive) it is almost guaranteed he would be elected-by the time of John Casimir's death Vasas would rule Poland-Lithuania from over 80 years, John Casimir became quite unpopular IOTL but lack of heir was one of most important reasons for it-lacking sons he tried to ensure election of Henri, prince Conde, who was married to his wife's niece-idea of election vivente rege of "some Frenchman" was really unpopular among nobles and was one of the reasons of civil war, he would not do it if he had a son.
Other option is personal union with territory which is bot hereditary monarchy and valuable land for PLC (it could be Moldavia or Prussia). I've planned timeline, where Albert Frederick Hohenzollern, duke of Prussia (and cousin of Sigismund Augustus) converted to Catholicism and won first or second free election, as result he became elected king of PLC (with Jagiellonian blood in his veins) and hereditary ruler of Ducal Prussia in one person.