There must be exactly one possible path for neutral current to get from any outlet (light or receptacle or appliance, etc) back to the panel neutral. The corresponding hot path for current must follow that same physical path from the panel breaker, with the exception that (in a switch loop) the hot path may diverge from its neutal to go to a switch and return back to (e.g. light fixture box) where it diverged.
You may not "grab" a neutral in a different cable, even on the same branch circuit, to go with a given hot conductor.
The most modern code requires a neutral going to the switch box. Switch loops for power arriving first at a light box can still be created. Here a one way neutral accompanies the raw hot, e.g. black and white wires in a 3 conductor cable. Raw hot and switched hot properly accompany each other, e.g. black and red in the 3 conductor cable. But neutral for the light goes directly to the light, not coming back from the switch on a second white wire accompanying the switched hot conductor.
Yes you can repurpose the second switch loop to become a new raw hot and matching neutral entering the switch box, provided you can prove that this is what you accomplished (may require some wire tracing).
Then yes you can repurpose the first switch loop be be a new continuation of switched hot and neutral to the light, decommissioning the original raw hot and neutral going first to that light.
Then finally install a new programmable switch, discarding the new switch you fried.