Remove references to globals through `this` in AMD factories

Fixes #17829
Port Node.js loader plugin fixes from d2c

Fixes #18235, #18236.
Refs #18168. dojo/on: adjust feature detection such that it also works in iOS 8 (beta) with a built dojo/on stripping the strict mode