I think the easiest answer is that you get what you pay for, but what you pay for depends on what you end up buying. Some products are more luxury or lifestyle brands that you end up paying more for looks and brand name, others might be for more their quality build and fit and finish, others might be the service and warranty or the people behind it, etc. And sound of course.
You generally pay for all of the above to a certain extent, but some products you will pay more for the sound, others more the build, others the looks or the brand and service, etc. If you want to, you can buy something that isn’t very sound focused, or go for something mostly sound focused, but irritatingly the main way to tell that is to hear it. You can have more equal everything, but cost explodes at that point lol
(more generalized toward audio in general rather than headphones) In terms of what can make audio gear expensive in terms of the sound side of things, R&D is a huge one, you could have everything else right but then have a shit design/setup, so you typically see higher end companies invest more into R&D in order to get the sound they are after and offer more compelling results. Another one would be component quality, some of the really nice caps, drivers or driver materials, transformers, volume solutions, etc get up there in price, and that obs contributes to cost. Another one would be the actual assembly and internal build quality and tight qc to ensure their product meets or exceeds their standards which typically also results in better sound as well.
Of course there are margins on top of everything, but some audio gear will be very high margin, others not. Depends on the company and product, and in the end, if the sound justifies the cost then it’s not a big deal. The problem comes when the sound doesn’t justify the cost lol
Edit: I will say though, typically in the high end you aren’t really paying more for only a special tuning or something (at least in most cases, also assuming you mean strictly FR), most of what you pay more for are the intangibles rather than a special FR since imo that matters a lot more in the high end rather than the FR, the intangibles color the sound a lot more than the FR does in the upper ranges
In the teak example, a good straight upgrade is the th900 from a technicality perspective (somewhat different signature but not too far off). It’s a better driver, with a bit more refined cups, with very similar build and slightly better fit and finish on said cups. What you pay for is mainly going into the better driver, better r&d on that driver and cup design, stricter qc and assembly/build, and higher quality cups with nicer fit and finish, which most contribute to better sound and you pay for that