Boot a Fedora on USB and start by doing a backup. Backup of /etc and your whole /home folder. So you have a clean backup of your data + Firefox bookmarks and passwords somewhere.
Once a backup is done, I would probably do a clean install of the Fedora 40 to check if something is wrong when trying to use that machine with Fedora 40.
I did get a botched upgrade from 38 to 39 that ended me do a full reinstall, and the reinstall worked fine. I could have tried to find out what the issue was, but I needed that laptop to work, so a clean install did it.
From what I can see in your log, I think you may have a faulty symbolic link.
Get into : /etc/systemd/system
You have several links there. Make sure they each are valid.