I’m experiencing this error too. For me it occurs when loading a front facing profile page.
It seems like the problem is definitely the load order. I have a developed a theme that moves jquery into the footer (more specifically into the wp_footer action) and being that the script executes inline, it causes the error.
Maybe a dynamically generated script included in the bottom of the pages would solve this problem.