Because the government says so. The Home Mortgage Disclosure Act of 1975 established regulations that the lenders must follow when reporting to whom and when loans were made. The lenders are to be monitored to see if they discriminate on placing their loans.
Also, the lenders must report the number of loans made to different races, genders, and age. Therefore, you will be asked your date of birth. You will also be asked the other questions.
You have the right not to answer the questions. Lender asks, “What is your race?”, and you reply that it is none of their business. Strange thing in the regulation. If you do not answer, the person asking must enter their opinion of these factors based on their visual observation of you and your surname.
Then, all this information goes into a big, big, big Report. One for each lender yearly. This document is then checked by Federal Regulators to ascertain whether the lender was unbiased in their lending procedures. Next time you are at your friendly bank, ask if you may see their most current HMDA report.