Any magnet in the middle of the string was quickly busted. It either fell down when the extruder moved towards it, it moved out of position, or it caused the string to jam.
Measuring the height of the the end of the string was the next easiest idea. It can't use a magnet because then it would stick to the printer. Another candidate for replacing the magnet is a short focal length mouse camera pointed at the known path of the string.
There are notes for using a mouse camera, though it can be expensive if you don't already have a spare mouse. A webcam might be better.
A photointerrupter might detect the weight. These just can't use edge detection to overcome ambient light.
The big problem became tensioning the string. The end of the string has to move a lot more than the height of the printer. The printer can't always be on the edge of a table, but it's almost a requirement for a decent runout sensor. To overcome this problem, the string could be raised 10" above the printer on a dowel but it would wobble & require a large structure. A test of raised string showed a lot more friction, since the string has to bend down.
This actually works. At this elevation, the filament only moves in the confines of its roll. The assembly just needs round edges to reduce the friction.
Routing the string requires some complex structures on its own. Even putting it in a tube creates too much friction. A differential pulley would increase the friction.
The most robust solution is a sensored brushless motor exerting constant tension but it's expensive. A brushed motor would wear out. Motorized tension couldn't use a photointerrupter & would most certainly have to use a webcam.
From experience, PLA is going to chew up any stationary string or switch contacting it. That's why any commercial runout sensor has rollers contacting the PLA. It could only be used when the roll is nearly empty.
Prusa, the gold standard, has a low profile photo interrupter on top of the extruder. The trick is it's real close to the end & it adds another 4 wires. It only has enough lead time to stop the print. The user can't splice in another roll. There could be a wireless sensor powered by the bed leveler. The bed leveler, nozzle fan, & heater should use the same power lines.