Is it a bug if the program couldn’t build a regular expression from a static string literal? Yup. The programmer typed that regex. It should be correct. So a panic is appropriate.
The only time I find unwrapping tolerable is when I personally put a literal Some in an optional just before the unwrap, so that it's blatantly obvious there will be no possibility for panic.
In the above case, you are instead relying on a computation (getting the parent of a path) behaving in a particular way and returning a particular value. That's pretty fragile.
You should indeed invert the dependency and compute the child from the parent, not the other way around.