Let's say I want to assess how comfortable a candidate is with casual conversation, and if he would fit into our business culture. If I ask a question like "What kind of music do you like?", is that legal? The question is definitely not relevant to essential job functions, but based on how he answers I can assess how well he would fit in our company culture.
Are all interview questions that don't apply to essential functions illegal?
No. Not all such questions are illegal, but see one exception from California legislation as pointed out by @GeorgeWhite and others in section 432.7 of the state Labor Code. Other jurisdictions very likely have equivalent prohibitions, but questions like the one you envisioned ("What music do you like") would not infringe statutory provisions.
Generally speaking, it is lawful for an employer to assess candidates' personality & non-essential skills under casual and not-so-casual scenarios through the use of questions with no relevance to the job at issue. Only in very specific circumstances certain pattern(s) of questions may lead to a finding of harassment or discrimination.
Questions related to categories which the Civil Rights Act protects are risky because a rejected candidate would have at least some grounds for a claim of discrimination. Those categories are [candidate's] race, color, religion, sex, and national origin.
Questions on those protected categories are not illegal, but the employer will have the burden of proving that its challenged practice (i.e., making seemingly discriminatory questions) "is job related for the position in question and consistent with business necessity" (see 42 USC § 2000e-2(k)(1)(A)(ii)) rather than for purposes of unlawful discrimination.
A better way to ask those types of evaluative questions would be: We like to enjoy "casual Fridays' here. One team brings in donuts or muffins in the morning, we dress business comfortable, sometimes we'll play music if we are able. What type of music do you enjoy? We play a variety. You can bring in your favorite." OR, "Sometimes the team goes out for cocktails after work on Fridays, would you be comfortable joining us? Not everyone orders alcohol, most do, but we like the comradarie the atmosphere inspires."
IOW, put the question in context.