In the past, when the SSD dies on these older Macbooks, you just replace the SSD with a new one. Very important for long term use when it eventually goes out of warranty, since there would be no need to go to the Apple Store to get it replaced for a fee.
On the M1 Macbooks, thats it. It's bricked and your data is lost and no way to recover it. (If you didn't backup in advance) You might as well buy another one.
In my case, I will continue to use my old Macbook and wait until Apple fixes the excessive writes or swapping issues in a newer version of macOS. By then I would be getting a Macbook with a newer M1X or M2 processor that doesn't have the excessive swapping issues and the software ecosystem for Apple Silicon would already have caught up with it and will be optimised for the processor.
I said it before with Apple products [0] [1] [2] [3], I always ignore the first generation unless you want to be a bleeding edge beta tester trying to get work done or you're after collector editions.
[0] https://news.ycombinator.com/item?id=25066248
[1] https://news.ycombinator.com/item?id=23638202