> Hope you had a good backup because the only way to fix it is to set it up again from scratch.
You can get that from any homelab setup though. Personally, I long since went the route of regularly setting up my Pis from scratch using Ansible - that way I at least know that I didn't forget to commit any manual changes made.
Pi-specific, my recommendation is to have a serious power supply. For the old Pis with Micro USB, Meanwell makes good ones, link that with a good wire gauge (18 AWG or more) and off you go. New Pis with USB-C, Anker power supply and a decent USB-C cable... that solves a lot of microSD corruption issues because the power regulation to the card isn't that good and just passes through brownouts/undervoltage conditions.
And the second recommendation, use "industrial" microSD cards, preferably those that are SLC. Grab them from Mouser, yes they are a bit more expensive than "normal" microSD cards but will live so much longer.
[1] https://www.mouser.de/ProductDetail/SanDisk/SDSDQED-008G-XI