I have actually found an edge case on the getPath method missing: the Drupal request attributes contain the User entity for key 0. This means that '_route' == $key && is_object($value) is true and $value->getPath() throws a "Call to undefined method Drupal\user\Entity\User::getPath()"

I will submit a pull request for replacing the == by ===, by far the simplest solution.