Add code to check for require.on before calling it to allow dojox/app to work with other loaders.

Add code to check for require.on before calling it to allow dojox/app to work with other loaders. fixes #18171