Just a thought, would welding the sprocket and retaining nut onto the driven shaft from the gear box cause the welded parts to lose its tempering and soften the steel?
There is a problem when welding on cars, so assume it is the same with motorcycles, with the alternator/generator, the voltage from electric welding can fry them, I believe the alternator should be removed from a car before welding , don't know if the same rule applies to the on-board computer, might be wise to ask the question of someone who really knows before going ahead, cos, you just might make your situation worse.
As mentioned in here earlier their has been incidents of the front sprocket coming right off the shaft causing the drive chain and back wheel to lock up, not good.
The original sprocket retaining nut was 9mm thick and Yamaha recognised this was an issue and produced a replacement nut being 12mm thick, this is supposed to cure the problem, well that's OK if the nut has come undone and has been noticed straight away but if the bike has done sufficient miles with the sprocket and nut chattering away it trashes the threads on the end of the gearbox shaft, then it seems you are left with two options a strip down of the engine and replace the gearbox shaft (Expensive and time consuming) or weld the new sprocket on.
So my guess would be the shaft in your gear box is f----d, hence the welding that's been done.