The torque that the magnet supplies was stored during the period that the half moon shaped gear was engaged. The magnet didn't provide any additional torque. It just released the stored torque.
Another way to look at it is it takes torque to separate the magnets away from each other while the half moon gear is engaged. As the magnets then attract back together that torque is released.
There is absolutely no free energy and no additional torque being generated.
In fact, the movement of the magnets likely generates eddy currents in surrounding materials which robs energy from the system. Which means it transfers torque less efficiently than just two gears. Your idea will likely produce less torque than just two plain gears meshing together.
Regardless of any possible ratio change:
All energy output from this gear system is equal to, if not less than, the energy input.
With that said, if the total energy remains the same and there is a ratio that produces more turns on the output than was input, then the torque must be less on the output. Total energy (HP or kW) is proportional to RPM x torque. If the RPM increases, then torque will decrease.