If an engine dies you can find good used ones pretty cheap. You can't find used battery packs cheap, as any "cheap" ones will likely have been removed because they are knackered. Also Tesla will ban it from using their chargers if they find out someone other than them repairs one of their cars! They pretty much have you over a barrel and I'd rather own a Range Rover out of warranty than a Tesla.
Battery for a 40kwh leaf is 4k to replace.
You don't need to replace the whole battery pack - just the dead cells, which will cost a few hundred pounds. There are plenty of YouTube videos which shows how the process works.