How to load absolute CSS and JS assets
Solutions
These are aggregated assets, so you need to find out how they get added there in the first place. Then you can alter them most likely via hook_page_attachments_alter
. Similar to Make canonical URL in document HEAD absolute.
Problematic about this approach is that these assets should are aggregated with that cryptic hash in their name per environment. So you need to switch off your custom module everywhere else except on the live instance.
Even though you don't want to use a contrib module I will recommend the CDN module anyways. It does what you want, but if you don't want to use it you can still look at how they do it.
They define a lot of services, but the most interesting one is this one:
cdn.file_url_generator:
class: Drupal\cdn\File\FileUrlGenerator
arguments: ['@app.root', '@file_system', '@stream_wrapper_manager', '@request_stack', '@private_key', '@cdn.settings']
The class FileUrlGenerator
then does checks for files to determine if they should be rewritten and rewrites them.