update "is jQuery defined" check for UMD compatibility

Addresses #13811, although the tests mentioned in that issue also need to be added.