How does Magento\Setup\Module\Di\Compiler\Config\Chain\InterceptorSubstitution::modify() work?

Context: How are the generated/medatata files generated in Magento 2.2?

Details: How does Magento\Setup\Module\Di\Compiler\Config\Chain\InterceptorSubstitution::getInterceptorsList() work?

Details: How does Magento\Setup\Module\Di\Compiler\Config\Chain\InterceptorSubstitution::resolvePreferences() work?