I managed to track down where setFactory is defined.
https://github.com/nette/di/blob/master/src/DI/Definitions/ServiceDefinition.php#L62
https://github.com/nette/di/blob/master/src/DI/Definitions/Statement.php#L34
https://github.com/nette/di/blob/master/src/DI/Definitions/Reference.php#L39
Maybe with this will provide you the information you need to finish debugging the issue. I'm not a Nette user myself so it doesn't really tell me much but it might be just what you need.