In VS Code 1.42 we will introduce a new hook resolveDebugConfigurationWithSubstitutedVariables in the extension API that receives the debug configuration with all variables resolved.
So there is no need to resolve the variables yourself anymore here.