They used a difference-in-differences[1] to control for such longitudinal/temporal effects. Since ChatGPT isn't readily available in China or Russia, but StackOverflow is, they can compare how SO changed pre and post ChatGPT in countries where it is widely available and compare that to the pre and post in countries where it isn't available (basically as the control).
[1] https://en.wikipedia.org/wiki/Difference_in_differences