First off, I have my own base theme in my product. I don't use diazo to customize plone, I wrote my own .pt files for my base theme.
The error is in Products/CMFPlone/resources/browser/scripts.pt
So, since this is a template file, I could simply use jbot to temporarily fix it.
I copied it to my base theme folder basetheme/browser/templates/Products.CMFPlone.resources.browser.scripts.pt to sit with all my other templates, and made the fix there. Restarted Plone and things are now working as expected.
I guess after the next release of 5.1 this will be part of the fix, and I can simply delete my scripts.pt file