To give a concrete implementation of what @dave_thompson_085 said, this does the trick - it extracts the public key from each of the certificate and the private key, then calculates their md5 hash, allowing you to compare them easily:
# openssl x509 -pubkey -in mydomain-ecc.crt -noout | openssl md5
# openssl pkey -pubout -in mydomain-ecc.key | openssl md5
Since this question was posted, an answer has been added to the question linked by the OP, providing a one-liner that will also work with ECC certs (using
pkey instead of
rsa), but it doesn't provide visible confirmation.