Use subdomain for S3 assets in multi-site Craft installation
Your example of setting the S3 "URL Prefix" setting to something dynamic won't work because there are only a few settings in the Control Panel that Craft parses for dynamic Twig content and that isn't one of them.  i.e. in an Asset Field's Upload Location, Section Title/URL Formats, etc.

Honestly, I don't think there currently is a way to do that in Craft 2.

This should be possible in the upcoming Craft 3 by overriding the setting in config/volumes.php and doing your dynamic logic from PHP.