How to make Drupal 8 use only relative URLs?
Maybe you can take a look at this function new to Drupal 8 :

file_url_transform_relative()

Once you pass an uri through file_create_url() you get an absolute url. You can then pass it to file_url_transform_relative() and you'll get the relative path if indeed it's pointed to a local file.