The wish to leave a personal legacy strikes me as one more piece of human hubris. Memories matter, but they do not need to be kept forever so that my ego is never forgotten. Ernest Becker called such efforts immortality projects: ways of making our significance outlast our lives. It is fine if the universe forgets us.
I am a terrestrial African ape, made by the universe and allowed, for a while, to see it. The universe owes me nothing, so the right response is to notice what I was given and enjoy the damn moment.
That sounded too bleak to me once I had written about beauty, and I think I see why. Two wishes hide in one word. Legacy is wanting my name to last, which is a way of winning. Posterity is wanting the good thing to last, with or without my name on it. Erik Erikson called that second wish generativity, a concern for the next generation.
To me it is the sense of beauty pointed forward. You plant the tree because a world with the tree in it is better, not because anyone will remember who planted it.
Bertrand Russell answered the fear of death by letting the walls of the ego recede. The same cure works here. Drop the legacy. Keep the posterity. Then go back to the moment.