Fix support for `^:replace` metadata on `:repositories` (fixes #1695)

As described in #1695, the `^:replace` metadata for the
`:repositories` section of the project file stopped working
around 2.4.0 (commit 17e91e6).

This commit adds a failing test that illustrates the
behavior.