Fix Issue 12705 and Fixup Pull 3501 - Fix @system and missing attributes when typeof(func) is used

Fixes: https://issues.dlang.org/show_bug.cgi?id=12705

And is a fixup for https://github.com/D-Programming-Language/dmd/pull/3501