As he made his final appearance at global gatherings, including at the Group of 20 summit in Brazil, President Biden lobbied for his foreign policy goals even as leaders shifted attention away from him.