Here are a few facts:
In 1562 the first castrato sang in the Sistine Choir in Rome. This is, as I suspected, long before the invention of opera at the end of the century.
The early operas of Peri and Caccini for Florence were sung by natural male and female voices.
In Monteverdi's L'Orfeo for Mantua the male voices were natural males while the female roles were sung by castrati.
This is all so confusing.
In the Roman opera period c. 1620-40 there were no women performers. The female roles and maybe even some of the males were sung by castrati.
Monteverdi's L'incoronazione di Poppea, written for the commercial opera in Venice, had a woman sing Poppea and a castrato as Nero. Amore was also sung by a castrato.
By Handel's time most of the male roles in Italian opera, especially the heroes, were sung by castrati and the female roles were sung by women. They seem to have settled on a gender identification of castrati as male.
But just so you aren't suddenly becoming unconfused, not always.
Royal Opera House 2021-22 Review: Rigoletto
2 hours ago