I don't have a better answer to the question as you already showed in the second code snippet but I wonder if we could extend key-paths with functions like mapValue and compactMapValue which would operate on Value and transform the value to the generic type of the function.
let path = \Foo.bar
let mappedPath = path.mapValue { Optional($0) } // escaping a `Value -> Value?` closure for transformation during extraction of the value
let value = foo[keyPath: mappedPath] // will extract `String` and then map it into `String?` with the above closure
@Joe_Groff what do you think?