perf(core): use index-based `SafeArrayIterator` in primordials (#36543)