Preparation for the issue 13701 - fix AA.dup for const elements

Required by: https://github.com/D-Programming-Language/dmd/pull/4148

After fixing issue 13701, `aa[k] = v;` will be rejected if the element of the `aa` is not mutable. Therefore it should be improved before the compiler fix.

Note that, the improved `dup` is not CTFEable. To keep `aa.dup` workable in CTFE, the CTFE interpreter in the compiler should handle `aa.dup` specially.
Currentry the purity and nothrowness of toHash is just ignored on the AA assignment `aa[key] = val;`. It should go a searated issue.