It may be the case that some bureaucrat (or statistician) had a lot of time on their hands, and thought it would be nice to have this info.

If only that were the case.
I rest assured that for those destinations where this is a part of the visa application form for business and/or tourist visitors, the demand for the information is generally not arising out of a bureaucrat's (or statistician's) benevolent interest in generating data about the demographic background of tourists in the aggregate. Rather it is more about the following: "security" paranoia. That and figuring out when/if/how (not) to grant a visa (if any) to the applicant -- a determination made based on an individual applicant's ethnic and/or religious affiliation(s) -- and to figure out who to target/tail upon arrival in the country (even if granted a visa).
Ironically perhaps, at least one such host country is more likely to discriminate against foreign citizen visa applicants with host country indigenous ethnic background(s) than to discriminate against foreign citizen applicants with no host country indigenous ethnic background even when it is clear that those foreigners of host country indigenous ethnic backgrounds are no more likely to violate the law once in the host country than others.
For example, one such country that has forms that include a religion field on visa applications: India. Natural-born US citizens of exclusively Indian ethnic origins (or perceived to be of such ethnic backgrounds) but applying for an Indian visa are more likely to be given problems (or additional document handover requirements) by the Indian government when applying for an Indian visa than the ethnic Polish-American spouse of such an Indian-American applicant.