MDL-14460, fix get_context_instance, merged from MOODLE_19_STABLE, see tracker.