1. Very few people leave a legacy. The people that do often didn't do it deliberately or intentionally.
2. They don't. There might be a few people half your age that know as much about programming as you do, but the majority don't. In any case, you are the worst person to judge what special thing you bring to the table. Go and ask one of these young people that you fear / respect / admire / think are knowledgeable and ask them to tell you what value you bring. The answer will surprise you.
3. A lot of people have pondered the meaning of life. Opinions differ on whether we've made any progress on that question. It's OK to go on a journey of "spiritual discovery" at 37; it doesn't require heading overseas to a monastery.