I once pondered about a related generalization: an explicit ellipsis in the identifier. For example `*foo` will match any suitable identifier that ends with `foo`, and it should be uniquely resolved at the end. More ergonomic syntax would use a separator to imply wildcards: for example, an identifier should be a sequence of words separated by `-`, so that `-foo`, `foo-` and `-foo-` really mean `*-foo`, `foo-*` and `*-foo-*` respectively. This can be used to implement a simpler form of module paths.
I'm imagining you're going to want a kick-ass IDE/linter/VSCode plugin to handle the case when you create a new variable that matches an existing pattern, and automatically making existing references more precise.
Though it might be easier to go the other way - at the presentation layer, automatically shorten variables to the least specific yet unique suffix or something.