Various indicia are observed, sex (more accurately, “socially ascribed gender”, but the established terminology is “sex”) is assigned based on some subset of sex-related indicia.
> The modern construct of gender
The modern understanding of the distinction between sex, ascribed gender, and gender identity may be new, but the things themselves aren’t modern constructs. Biological sex (or at least the individual traits that make it up), socially ascribed gender, and gender identity have always existed.