The browser knows the "key is valid for the domain" by the existence of a certificate from a certificate authority which says the key is valid for the domain. The server sends this certificate to the browser to verify its own authenticity.
The certificate authority knows this by (effectively) asking the domain what its key is. There are several methods to do this - one of them is to make an unencrypted HTTP request.
The certificate authority knows this by (effectively) asking the domain what its key is. There are several methods to do this - one of them is to make an unencrypted HTTP request.
Is it a stupid system? Yes!