I clarify:
Let’s say scientists can’t come up with solutions to global problems, AI gets out of control and turns almost everyone into paperclips during wars, and in the 2040s or 2050s, the surviving people (about a few tens of millions around the world or even less) gradually return to the level of intelligence of their distant ancestors?


I think that your question might be flawed on the front of intelligence. Assuming that the AI doesn’t specifically target the brightest people in the world, I don’t think that the overall intelligence of the world would go down. Besides, I don’t believe that it would be very easy to hit humanity as a whole to cause us to regress completely down there. For one, it’s likely incredibly difficult to have all the accumulated knowledge of over 10 millennia to get erased. It’s likely that the knowledge of metallurgy, chemistry, and medicine will still be floating around, be it written down, stored on a device, or a specialist having memorized it. Sure, some knowledge would absolutely get lost. But specifically the Neolithic era is where we see the beginnings of society. Agriculture was a major achievement for humanity, as it enabled us to specialize, and establish permanent settlements. There’s also another factor to consider: the ruins of our previous height will still be there. People would absolutely go and scavenge the ruins for things that we as a whole would have lost. Yes, people would absolutely die, but I don’t believe that humanity as a whole would be screwed.