I'll try to weigh in here, a little late.
There are two factors in play here: Cost accounting and Elon Asperger.
Cost accounting is how companies determine the total costs that go into a finished product. For manufacturing it includes,
inter alia, raw materials, labor, supplies, shipping, depreciation on equipment and real property, carrying costs like interest and taxes, a healthy allocation of overhead, and recapture of prior costs that developed a process amortized over the expected output over time.
From this analysis the bean counters submit to management to determine the selling price of the unit in line with their targeted gross profit. No doubt these batteries are produced on some sort of mass scale. It gets tricky because the largest percentage of batteries manufactured are components of an entire automobile. A lot of the overhead that is capitalized for just the batteries is also part of the finished automobile, so the cost accountants will come up with some apportionment so that the overhead is not double-counted for pricing a new car.
It is entirely possible that the mass produced battery cost is ~$100/kWh
as a component of a new car. But as a stand-alone part to replace in an existing vehicle it may be more. I don't know Tesla's manufacturing process. But there could be a premium built in to the price to allow for the much slower inventory turnover and much lower demand. I can remember many years ago some automotive writer would price a new car using retail prices of all the components, from engines and transmissions to window glass and tires, and the price of just the parts was something like 4 times the new car price! This situation may be why a replacement battery has a much higher resale price.
I would look at it this way: If a customer told Tesla that he wanted to replace all the old 85kWh batteries in his 2013-2014 fleet of 100 Model S, you can rest assured that the price charge to this fictional customer would be a lot less than $22,000 a pop, perhaps as much as $5-6,000 less.
It is not clear to me whether the old battery (the alleged core charge) has any utility to be reused and remanufactured. In ICE, many of the components can be rebuilt or remanufactured and be as good as brand new parts. Hence, the core charge. Maybe the skateboard can be reused. Maybe the cells can be recycled or reused in other applications after thorough diagnostic testing. Maybe the cost to Tesla ain't cheap, so the $15,000 charge to keep the battery is approximately what it would cost Tesla to reclaim, recycle, or repurpose the bad one. Or maybe Tesla does not want its customers to tear apart their batteries to reverse engineer them, and they figure that $15,000 is enough of a deterrent. Or maybe I am ultracrepidarian and should stick to accounting!
The second factor is that once upon a time, Mr. Musk declared that Tesla's Service Centers would never be a profit center. He said that if they broke even, then that was fine. But Tesla was not going to price its service and repair to make $$$$.
I think this has changed. I think that Musk wants the service centers to be cash flow positive and even make a modest contribution to the bottom line. Accordingly, the company will charge higher than customary prices for replacement parts to effect this objective. We have noticed that Tesla now charges diagnostic fees to assess issues, and frequently these fees are not credited against actual repairs made as a result of the diagnosis. The customer pays for parts, labor, and diagnosis. This may not be true 100% of the time at all locations, but there have been reports on this forum where this happened.