It depends. The effort to protect the magnetometer is huge if you want to hold a constant temperature in space. It is easyer to measure the temperature and use the information to calibrate the magnetometer data.
Mainstream approach is to use enough MLI so magnetic sensor can be kept above minimal working temperature by self-heating. The effect on maximal temperature is much smaller because radiative transfer is ~T^4
If it not enough, use constant-power heater.
If temperature variation is still too large, add thermostat control to heater.
Usually, there is no need for Peltier system for magetometer- although i remember Peltier cooler was used in S3S star tracker.
PE modules tend to use a lot of power, and aren't very efficient in cooling mode. As much as possible, thermally shield the unit from the sun so that it is as cold as possible, then insulate it and heat it with a strip heater.
Remember that there's no convection in a vacuum, heat transfer is primarily through conduction and infra-red emission. This is why NASA paints everything white if possible: to reduce the thermal emissivity and absorption. Actively cool only if absolutely necessary. Remember, the heat has to go somewhere and must ultimately be dumped into space through a radiator.
In general, s/c thermal systems are designed to keep everything within the body of the s/c within some nominal temperature range. Thermal system design is a separate topic (best addressed to a thermal group). in any case, my experience with large and small s/c shows that it is not hard to maintain temperature within the body of the s/c to some acceptable range (e.g. -20 to +30 C). In general, this is good enough for any attitude system.
FYI: I have also dealt with science grade magnetometers that were mounted on booms external to the body of the s/c. In this case, the thermal system is a combination of blanketing and heaters.