First check the shaft and gear if it wobble ever so slightly, and if it show difference in gear lash with an indicator clock and feeler wire. The magneto shaft end does bend easily, and the gear can have a fault in it so it is out of center. That has impact later when you try to adjust the gear play when mounting the magneto. The gear lash HAS to be quite large, a tick-tock has to be heard in all positions around the revolution when you rock the gears. Because of the tiny bearings, the magneto do not fancy unequal gear lash and can not take sustained side load from the gears.
Don't be tempted to pry or pack something behind the gear in trying to tap the gear loose from the shaft. The threads on the shaft (if they haven't been damaged and cut off already) are soft and fragile. And to that, the aluminium cam cover is fragile and/or bend easily.
Best is to make a designated puller for it, larger of course and maybe in 2 halves, but similar to that one you need for the pinion gear. The puller doesn't need to be overly strong if it grabs a large portion of the circumference. A modified common 2-3 leg puller with narrow hooks at the ends can be risky and break off a cog, best is to make a puller that has as wide contact area as practical.
Using heat is a bit dangerous depending on what heat source you use, because the gear is heat treated, and that also involve some tapping on the shaft. The bearings in the magneto are very small and do not sit directly in the housing, they are shimsed with some electric current isolating wax coated paper! So they can't take hard knocks or much heat.
Of course when you have put tension on the puller, a light tapping on it may be needed to release the gear, but to ease on the impact on the bearings, I pull with my hand on the puller at the same time I tap on the screw. I don't know if it make any difference at all at the bearing end, because in a healthy Bosch, the shaft end play should be set to zero, but I feel like I care.. :-)