I have for the most part organized my professional life to make the following thing possible:
If there is a question I am interested in, I am happy rather than sad if someone solves it satisfactorily before me.
This means I do not work on high-value “leaves” in the tree of knowledge, where a solution would bring great prestige but little transferable knowledge. I would be very happy if the “leaves” become devalued in the coming years, and just get blown away and raked up.
My style of work is to have something I want to be able to *do* but can’t yet, and then work on fundamental problems a few layers below in the stack. Over time I get closer to the surface, and if someone resolves one of those fundamental problems before me, it just accelerates my progress toward the goal.
This is a low-stress high-reward style of doing science, and I encourage anyone who feels anxiety over being “scooped” to try it out.