Curious, why did www.foo.com become the standard instead of using the apex/root foo.com domain? Was this because of the DNS limitations of using CNAME records at the apex/root?
Because HTTP was one service among many, not the primary one, and failed to use a different DNS record than A to look up the target, unlike other protocols which manage this redirection to the "$protocol server" that way instead of through a subdomain name. (E.g. mail has MX records to find the mail server, many other protocols use SRV records to discover their specific targets)