Other systems that have a similar issue keep a domain name table so they can lookup the CNAME and avoid this issue but that's now how the S3 software was designed.
I think this would only apply on subdomains because a CNAME cannot be set on the root domain because the root domain is the DNS Start of Authority (SOA) which must be an IP.