Missed a couple of places to check for require.on before calling it to allow dojox/app to work with other loaders. fixes #18171

(cherry picked from commit 7503f6b57386a5a7915dc68af0dd3460599b09a2)
Add code to check for require.on before calling it to allow dojox/app to work with other loaders. fixes #18171

(cherry picked from commit 3f58ca49510561cdb1a27dc8af37ce694083244f)