Fixes ISSUE-47817: Cannot use new immutable function in function index
Now the immutable functions are created before the tables and its indexes. This way it is possible to define an immutable function, export it to a module and then reference it from a table index.