I think even better approach is the way Terrence Mckenna goes through all of this in his book exploring the hermetic tradition
And I agree with you on motivated reasoning but that is arguably just how human intelligence works and in this case everybody in their current time was doing the best that they could with the tools that they had. So I don’t mean to diminish former practitioners of what they called science or epistemological reasoning, or natural philosophy.
At the same time as scientists were constantly identifying when new mechanisms that better describe natural phenomenon retire old social formations around them
In my view the main failure of humanity is not adapting social structures at the pace of epistemological change, this is Carl Sagan’s main complaint in the demon haunted world.