JS scripts not loading on certain pages
I don't know why it's not loading on some pages, but ultimately it's because the library isn't required for those pages. If a module's library is required by your theme then you need to declare it as a dependency.
You can do this for your library in your theme's libraries.yml file. See the Declaring dependencies documentation.
# my_theme.libraries.yml
# It's not clear if you want the bare or full cookie compliance library
my_library:
  js:
    js/my_libary.js: {}
  dependencies:
    - eu_cookie_compliance/eu_cookie_compliance
    - eu_cookie_compliance/eu_cookie_compliance_bare