code: public function beforeStep(Scope\StepScope $scope)
      {
          self::$pageUrl = $this->getCurrentUrl();
          // To allow Drupal use its internal, web-based functionality, such as "arg()" or "current_path()" etc.
          $_GET['q'] = ltrim(parse_url(static::$pageUrl)['path'], '/');
          drupal_path_initialize();
      }
docs: IMPORTANT! The "BeforeStep" hook should not be tagged, because steps has no tags!
  
  @param Scope\StepScope|Scope\BeforeStepScope $scope
  Scope of the processing step.
  
  @BeforeStep