Since I have been adversely affected by this bug ([1]), I looked at the patches.
I combined issue14364.test.patch (which adds test cases for --foo=--) and dbldash.patch in my local working tree and that seems to resolve the issue (tests pass if and only if I apply dbldash.patch and my reproducer from [1]) passes too).
The patches do not contain any type of metainformation, so I’m not comfortable with submitting this as a PR. I am also not at all familiar with the process of managing the changelog etc.
This should serve as a confirmation that this issue can be resolved with the patches. Someone more familiar than me with the process could take up the task to get this merged.
Note: As you can see in [1], this issue has already caused data loss.
[1]: https://github.com/borgbackup/borg/issues/4769