[FIX] Replace: Sharing exceptions and support XML

If multiple replacements share the same exceptions dictionary, they
will be compiled by the first replacement and replace the original
strings. The second replacement then tries to compile the already
compiled exceptions which fails.

To only compile each set of exceptions once, it now uses a list which is
aware of the exceptions all entries share and only compiles them if they
weren't compiled before.

Also the XML generator assumed that the replacements where a list of
tuples which changed with babc7cef9b7805b0bb8c2b5abab4b715e7fc1e7a so
XML needs to be aware of that.

Bug: T76940
Change-Id: Ifb8a66adb7d158c93a408bf1f558ea8e90b0a2b0