root module on allocation

While allocating a module, set_const and module_export can allocate memory so the module must be rooted.
This could be the cause of #6637 but I'm not sure.
I don't think anybody actually ever hit the second one since it is very rare but well...