There is a command that can rebuild the db to match the installed packages. It may potentially cause problems if there are extreme issues, but I have never seen any problems with running it when certain issues appear.
sudo rpm --rebuilddb
Using that command may fix the malformed database disk image error. One reference is here. Can I recreate a corrupted RPM database? - Unix & Linux Stack Exchange
The @System source is installed packages.
The terra repo can be identified with a quick search for terra repo on the internet. It is a 3rd party repo and in many cases those may cause conflicts with packages from the fedora repos. It appears you must have enabled that repo in some way (and potentially installed some packages from there) since it is not part of a fedora installation.
Both problem 1 and problem 2 show conflicts between packages with the same name from fedora and terra. It may resolve the errors if you run the dnf upgrade command with the --disablerepo terra option. A better, long term fix, would be to disable the terra repo and only enable it when you are installing/upgrading packages from that repo explicitly. sudo dnf --setopt=terra.enabled=0. After disabling it this way it can be enabled with the --enablerepo terra option when you wish to use it.
Having corrupted file system in btrfs would be the very first issue I would address, and those cannot be fixed with the file system mounted and active. Boot from a live image to perform those repairs.
Once the file system has been repaired and you are now able to boot the system again then the issues with the rpm database and the package installations can be addressed.
Always address the most critical error first (the btrfs errors).