I'm not sure I'm a fan of this because it just turns WayBackMachine into another content silo. It's called the world wide web for a reason, and this isn't helping. I can see it for corporate sites where they change content, remove pages, and break links without a moment's consideration. But for my personal site, for example, I'd much rather you link to me directly rather than content in WayBackMachine. Apart from any…
I use linkchecker for this on my personal sites: https://linkchecker.github.io/linkchecker/ There's a similar NodeJS program called blcl (broken-link-checker-local) which has the handy attribute that it works on local directories, making it particularly easy to use with static websites before deploying them. https://www.npmjs.com/package/broken-link-checker-local
linkchecker can do this as well, if you provide it a directory path instead of a url.