Their bond, forged at a party in 1991, endured for decades although it was tested in recent years amid revelations of Mr. Gates’s ties to Jeffrey Epstein.