BigPipe messing up JS, is there a BigPipe ready() equivalent function?
You must not ever rely on document.ready when you write js for drupal. You should use drupal behaviours; If used properly this will ensure that your code runs both on normal page loads and when data is loaded by AJAX (or BigPipe!)

Also read this interesting post on drupal issue queue JS relying on document.ready event does not work with BigPipe