OP, you are correct, Sir. I had a picture in my mind of a smaller machine without back gears. It will be necessary to get "ahead" of the back gears to track spindle speed. On a lathe, start with the chuck, collet, center. That's what is necessary to control. Work back from there looking for a place to mount the magnet. For a milling machine, there are fewer locations available but the process is the same. The final location must be before any gearing.
Way back when "cruise control" first appeared on automobiles, there were kits available to retrofit earlier models with cruise control. Speed control wasn't all that accurate, some kits would surge and some had a wide speed differental. Typical mounting of the magnet was on the drive shaft, just aft of the front U-joint. With the coil / sensor hanging from the transmission or drive shaft tunnel.
The mounting process was to clean (well) the drive shaft where the magnet was to mount. The magnet was then stuck to the drive shaft through its' own magnetism and held in place with tape. The specific tape was "packaging tape", a clear (Mylar?) tape with nylon strands. The stuff that's hard to cut and impossible to break by hand. I don't know the proper name but it is still widely used. If used on a clean surface, it is essentially oil and grease proof once applied. If used on a greasy or dirty surface it doesn't stick worth a damn. About like a worn out shoestring.
Used on a machine tool, a similar technique could be used. The spindle must be clean and oil free when taping. But opens up the possibility of mounting the magnet internally to the case / frame. Mounting the sensor might be more difficult, some machines use every cubic inch of internal space. Space between the magnet and the sensor isn't necessary to set with a feeler gauge. A paper match stick will serve. A "Hall Effect" sensor is more sensitive than a coil. A sharper leading and trailing edge. But also more directional. Which shouldn't matter in this application. But nice to be aware of.
.