Merge ExtractsRef into ExtractsPath
What does this MR do and why?
Contributes to #425379
Problem
ExtractsRef is used only by ExtractsPath. The separation of the code between two modules complicates the logic.
Solution
Merge ExtractsRef code into ExtractsPath. It should simplify further refactoring attempts to get rid of ExtractsPath module.