In reality they're charging $22k PLUS they keep the old one (which as you point out has significant value - others have said they want a $15k core charge if you ask to keep the old part).
The $15K core charge is logically defensible. That pack is useful to Tesla, as they may spend a week to break down the "bad" pack, identify healthy components, replace unhealthy and determine suitability of repurposing refitting for someone else's warranty replacement. The BMS boards and related hardware have been improved many times, it is not practical to maintain "forever" newly manufactured boards for 8+ year old packs, so the core charge is a real disincentive for owners, as it should be.
The labor cost alone is $4K (one weeks salary, benefits) then thousands per pack in costs for building/storage, equipment, testing rigs, software/firmware testing (to make sure old battery packs can be re-integrated properly), the list is long that Tesla invested in to provide this required warranty battery replacement option.
It floors me that owners believe this is simple and cheap to do, it's clearly and provably not.