How does Bash handle quoting in the string replacement section of parameter expansion?

As discussed in the comments, this seems to have changed between versions of Bash. I think this is the relevant change in bash-4.3-alpha (changelog):

zz. When using the pattern substitution word expansion, bash now runs the replacement string through quote removal, since it allows quotes in that string to act as escape characters. This is not backwards compatible, so it can be disabled by setting the bash compatibility mode to 4.2.

And the description for shopt -s compat42 (online manual):

compat42
If set, bash does not process the replacement string in the pattern substitution word expansion using quote removal.

The quoting single-quotes example:

$ s=abc\'def; echo "'${s//\'/\'\\\'\'}'"
'abc'\''def'

$ shopt -s compat42
$ s=abc\'def; echo "'${s//\'/\'\\\'\'}'"
'abc\'\\'\'def'

$ bash --version | head -1
GNU bash, version 4.4.12(1)-release (x86_64-pc-linux-gnu)

Workaround: put the replacement string in a variable, and don't use quotes inside the replacement:

$ shopt -s compat42
$ qq="'\''"; s=abc\'def; echo "'${s//\'/$qq}'";
'abc'\''def'
$ qq="'\''"; s=abc\'def; echo "'${s//\'/"$qq"}'";
'abc"'\''"def'

The funny thing is, that if the expansion is unquoted, then the quotes are removed after the substitution, in all versions. That is s=abc; echo ${s/b/""} prints ac. This of course doesn't happen with other expansions, e.g. s='a""c' ; echo ${s%x} outputs a""c.