refactor(kernel): use ro_metavar_env instead of metavar_env in places where we only need to read the metavariable environment

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>