Python was Civ 4. Civ 5 and 6 seem to both primarily use Lua for scripting.
That's marginally better, but it's still a million little hashtabe lookups.
Hashtable lookups are O(1). What are you complaining about? If they did this in plain C they'd probably end up using binary search trees and then everything would be slower.