Draft: Allow flag generator functions to be aware of the path they're generating
Cherry-picking one commit from !68582 (merged) as its own MR, as I would like to start to suggest we use this to clean up other flag generator functions.
myGeneratorFn()
functions remain supported, and myGeneratorFn(path)
functions are now additionally suported.