Let's say Abel defames Bob. Abel then studies law and becomes a judge, and about 30 years down the line becomes Supreme Court Judge Abel.
Now, Defamation is one of the shorter statutes of Limitation: The claim has to be made one year from the defaming statement. By the time Abel has his law degree, the case can no longer be brought and Bob has no legal recourse to sue. His case will be dismissed with prejudice for the statute of Limitations in the first instance, the appeals court will deny to review a case that is multiple decades past its statute of limitations and the Supreme court will deny to hear the case also.
As the case can't reach the supreme court, there is no reason for the judge to recuse themselves.
However, two much more likely setups are the following, and repeatedly have happened:
Judge Abel hears Bob's case in his time at the Court of Appeals and is elevated to SCOTUS. Then case slogs through the instances and ends up on the SCOTUS table years later. Judge Abel now should recuse themselves, since they had already judged on it.
Judge Abel has an investment in Bob Inc, and Bob Inc ends in front of SCOTUS, they should recuse themselves.
SCOTUS does not need to disclose their form of involvement with the case, so it is often a Black Box. To some degree, how often a judge recuses themselves is highly dependent on how long they are on the court: new judges like Barrett and Jackson are much more likely to meet their own old cases in court while judges that are on the bench longer have other reasons to recuse themselves.
But the decision of each judge is on their own, and at times there is critique on some of the judges that do not recuse themselves, as SCOTUS is the last instance and no other instance can review their decision to recuse themselves. However, most of the times, if a SCOTUS judge is an actual defendant, they will recuse themselves. Which... in case the whole court is sued jointly and separately - as happened in Shao v Roberts (et al.) - would usually lead to the whole bench recusing themselves for being involved with the case.