Not sure what the solution would be that is proposed by the legal experts but it seems to me that we already have a system for dealing with that for the office of the president in the form of vice presidents etc taking over if they die. Not that you should have to have an entire chain of people ready to take over for every SC justice but rather, if one dies or retires or whatever before their 18 years is up then a replacement can be appointed to finish the remainder of their term.
Laws override precedent. The court’s job is explicitly to interpret the laws made by congress. Precedent is simply the way that previous courts have interpreted the laws at the time. If the relevant laws to the case haven’t changed since the previous case, that is where precedent comes in. If there are new laws written by congress then those are more important than precedent.
Another user brought up the idea that they might still try to rule the new law unconstitutional but that would be a much harder bar to achieve legitimately since the constitution is intentionally rather succinct. Of course if the court is corrupt and no one actually challenges their power I suppose they could say anything they want- precedent overrules laws, anything they don’t like is unconstitutional, for the low low price of a vacation getaway you too can influence my rulings, etc. But legally speaking laws override precedent and doing away with a law because it is unconstitutional is an extremely high bar which can’t realistically be met by the vast majority of laws unless the law directly goes against the few rules that the constitution establishes.