elf: fix program::_module_index_list use-before-init

We create a memory_image and assign it to _core before *this is fully
initialized, triggering corruption in program::_module_index_list.

This fixes memory corruption issues seen with the upcoming demand paging
patches.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>