Knowing that I2C is a serial protocol that comes straight out of the chip that way, my best guess is that the mag chip is bad.
When you look at the System tab, AuxMagSettings->mag_bias, are all values zero? If so the mag is uncalibrated, so a "bad calibration" can be ruled out. If not zero, you can set them to zero, single click on mag_bias to highlight it, and press the red up arrow button to set these back to zero. Power off, on and retest.
If all zeros and problem still exists, I would:
- tap it fairly hard on the table in each of the 6 "cube face" directions
- degauss it. At least touch the strongest magnet you have to each of the 6 cube face directions to see if that changes anything. Rare earth airplane hatch cover magnet or magnet removed from a broken brushless motor, or the strongest refrigerator note magnet you have.
- retest to see if z axis is still maxed out.
There is a small chance that calibrating the mag will help. But first I would try to tap and degauss that mag sensor.
One of several DJI Naza flight controllers I bought new had a mag sensor that was out of range and would not calibrate. Degaussing it with mag field from the coil of a large soldering gun fixed it. If you have a soldering gun (not iron) you can find the strongest field by pulling the trigger and holding something made of iron or steel close to it to feel for the AC vibration.
Once it is working, to get rid of residual magnetism, switch a degausser / AC magnet on, then bring it close, then far away, then switch it off.