It's a pretty shitty state of affairs, but for ebooks what I've done is purchase an old model kindle and buy ebooks for it. I then crack that DRM using Calibre (easy to do with the old model kindles, you only need to enter the serial number). This has worked to archive all the books I've purchased so far but there may come a time when Amazon will only deliver ebooks to kindles with stronger DRM.
I don't feel bad about doing this because I'm still paying for the books and I'm not distributing the backups I make. I'm not clear on whether personal backups are a legal exception or not, but I don't really care.
I do the same with audiobooks from Audible, though the cracking process is a bit more complicated. I have no moral qualms about ensuring I will always have a copy of something I bought even if I leave the platform I bought it on or that platform goes under.
I don't feel bad about doing this because I'm still paying for the books and I'm not distributing the backups I make. I'm not clear on whether personal backups are a legal exception or not, but I don't really care.