I wish Debian had better support for software that wants to do its own package management.
They do it a little bit with python, but for most things it's either "stay within the wonderful Debian package management but then find out that the node thing you want to do is functionally impossible" or "abandon apt for a mismashed patchwork of randomly-placed and haphazardly-secured independently downloaded little mini-repos for Node, python, maybe some Docker containers, Composer, snap, some stuff that wants you to just wget a shell script and pipe it to sudo sh
, and God help you, Nvidia drivers. At least libc6 is secure though."
I wish that there was a big multiarch-style push to acknowledge that lots of things want to do their own little package management now, and that's okay, and somehow bring it into the fold (again their pyenv handling seems like a pretty good example of how it can be done in a mutually-working way) so it's harmonious with the packaging system instead of existing as something of an opponent to it. Maybe this already exists and I'm not aware of it but if it exists I'm not aware of it.
Sounds like serious hardware problems (bad memory sounds highly likely if that's what memtest is telling you). Replace the faulty hardware before changing out any software, and before the badness "spreads"; you may already have corrupted a certain amount of the data / installed software on your disk by writing back data after the bad memory corrupted it, if you've been running on the broken hardware for that long.