"They" has been used as a singular pronoun as far back as the late 1300s, but for the case where you didn't know the gender of the person or the gender was not relevant. Using it for someone whose gender is gender is known but is not male or female is much newer.
Here's an article with details [1].
The problem of what pronoun to use for someone who is neither male or female is not new, of course. That article says:
> There have always been people who didn’t conform to an expected gender expression, or who seemed to be neither male nor female. But we’ve struggled to find the right language to describe these people—and in particular, the right pronouns. In the 17th century, English laws concerning inheritance sometimes referred to people who didn’t fit a gender binary using the pronoun it, which, while dehumanizing, was conceived of as being the most grammatically fit answer to gendered pronouns around then
[1] https://www.merriam-webster.com/words-at-play/singular-nonbi...