SOCKS5 by itself just make sure that the necessary TCP connectivity to the target is created and that all data are forwarded between client and server. It also might do a DNS lookup to resolve the hostname. A plain SOCKS5 proxy does not change anything with the payloads or changes the requested target server which means that HSTS will continue to work the same as without proxy.
But what you see here as error has nothing to do with HSTS at all. ERR_SOCKS_CONNECTION_FAILED
means that the SOCKS5 server was unable to create a connection to the requested target. This is a problem creating the TCP connection already and has nothing to do with HTTPS and thus also not with HSTS.