[runtime] Add some low level locks to image sets to reduce contention and the usage of the loader lock.