Do not execute dojo/on until DOM is ready

This ensures that the focusin/out feature detection operates
properly even when people do not follow best practices and put
their code in the <head> instead of before </body>.

Refs #17599.

(cherry picked from commit 08187b88273f09326e5ebc8ea03eecd592e7eaca)