Yes, given that 1. the decennial census (along with what is now known as the companion American Community Survey) is mandated via Article 1 Section 2 of the constitution; 2. the collected data informs distribution of federal funds to state & local governments and 3. individual and business information is protected by law.
See: https://www.census.gov/history/www/through_the_decades/overview/ and https://www2.census.gov/programs-surveys/decennial/2020/program-management/working-papers/Uses-of-Census-Bureau-Data-in-Federal-Funds-Distribution.pdf
Inclusion of a question or questions pertaining to sexual orientation is effectively the next evolutionary step for ensuring proper / proportionate state-based representation & taxation as well as equitable distribution of federal funds to the states.
Census-related questions have varied in number and scope since the first census conducted in 1790 and have focused on a wide variety of topics including vocation, education & literacy, home ownership and finances & debt in addition to the typical demographic topics (same-sex marriage was included in the 2010 census). Reliance on census data to guide distribution of federal funds ramped up notably during the 1970’s and continues to the present day.
Title 13, enacted & put into law in 1954, protects the confidentiality of an individual’s information and data. Violation of Title 13 is a federal crime and the Census Bureau & employees are bound by the law.