Sorry for the Necropost, but Wisdom of the Ancients. This is for anyone that runs across this situation now and in the future with any builds.
I had the same situation as the OP. I bounced from 11.4 to 12.0 on my way to 12.3, I should have known better, but I digress. I managed to fix it without reinstalling on a remote 1000+ connection server, 1000 miles away, in a Linux shop datacenter. (So even if I paid $200/hr to fix it, they wouldn't be able to via USB.)
When you hosed the system and caused the core dumps and ld-elf.so.1: /lib/libmd.so.6: invalid file format errors, you should have at least 1 shell logged in as root. And your services should be running. You can't launch any programs outside of /rescue/. Whatever you do, don't disconnect or reboot the system.
So what happened? 11.4 is newer, so the /lib/ files are newer than what 12.0 tried to install. So the 12 /libs/ didn't install. I suspect this will happen anytime you jump from a newer old build to an older new build. You need to install 12.0 /lib/ files, which means you need to grab 12's base.txz.
Sadly, I don't see anything in /rescue/ that can do that. (It would be wonderful if they included wget or some sort of recovery program in there.)
This is where your services come into play. Luckily for me, I still had access to PHP, with a 15Mb upload limit. Yay! I download Base.txz on my local system and extracted it. The first job is to get sshd working in case of network failure.
Run sshd -t. It should spit out some broken libs. Find them in your local extraction of base and upload them to your PHP uploader (you either wrote one using /rescue/vi or you got something like forum software installed. Alternatively, if you have mail service still going, an email could work.). Move those libs to /lib/. I think I needed libssl.so.111, and I also brought in /lib/libedit.so since everything was complaining about it.
Run sshd, connect to it and log in. If you can, great! You're ready for the headlong charge.
You can either try to get wget running or upload /lib/ piecemeal. I chose the latter in 2 tar files. Make sure you have those files all in one folder, say 12BaseLib, as you're going to get only one chance at this. Using /rescue/cp -R copy everything in your uploaded 12BaseLib folder to the actual /lib/ folder. You're going to be kicked off shell as EVERYTHING will crash on the system because you're copying over libc and what have you. /rescue/cp should still do its job, though. At this point, you wait 10minutes. Then you send a tech support ticket to reboot the system. Wait another 10 minutes, and hopefully, you can log in.
If you can, you're almost home.
Now you need to Freebsd-update to 13, as that will copy over the most files. You'll run through that entire system, a few more things will fail, like libregex, but the install should go through. Sshd and a few other programs will break again. You will have to manually merge files because diff is broken. When you finish that, it will install, but there will be a few errors. At this point, a few programs will work, notably wget. Download the 13.0 base.txz, extract it to 13Base or something. You'll need to copy over the files you need for sshd to make sure it works again. Then using /rescue/cp move over the stuff in 13Base/usr/lib to /usr/lib and you'll also need to do the /share/ folder. This action shouldn't crash, but it might. At this point, you should be able to run pkg-static upgrade -f, and nothing should break. Finish up the install, verify that sshd works again, reboot. Clean up any config issues you have now with the update. (PHP 8, ugh)
That's what worked for me. All my services are running, the system reboots, no errors in my log files.
Keep 13Base.txz file around if you run into any missing or malformed files.
In the future, always bounce to the latest minor builds of Release. And download base.txz files to the system if you have the space. They're pretty handy if you screw something up.