> Is it reasonable to assume that the natural decline in cognitive performance over time is offset by the gains in experience and expertise?
So according to Carlsen, for chess the answer is no.
I personally also suspect the answer for programming is the same. Most, if not all, of the hotshot programmers we know became famous in their early 20s. Torvalds started writing Linux at 21. Carmack was 22 when Doom was released. Many of the most famous AI researchers were in their early 20s when doing the most groundbreaking work. Einstein's miracle year by the way was also when he was 26.