They go hand-in-hand. Surnames aren't gendered. Names that reverse gender are often surnames used as given names.
"John" or "Matthew" are probably never going to become female. Nor will "Elizabeth" or "Katherine" become male.
"Spencer" was male when Spencer Tracy was a big name. Today it could go either way. As a family name it relates to the profession of a steward.
A surname ending in “son” could be seen as at least a little bit gendered.
Surnames are gendered in some languages, typically when they're defined as gendered adjectives.
In Polish '...ski' is masculine and '...ska' is feminine. The prefix stays the same, so a brother and sister have slightly different surnames. (Like 'Wolski' vs 'Wolska.')
In the US some immigrants forgot this, so you get American women with a '...ski' surname.