I don't believe what we are discussing is illegal. What is the "bike" so far as the government is concerned? The headstock, it is the only part with a VIN and is a significant and critical part of the frame rather than just a small piece with a stamping. You have two bare frames, one with a clear title in your name but is damaged (bent, rust, etc.), another which is in good usable condition, not reported as stolen, and you purchased with documentation such as a bill of sale. This is sufficient in many states to title or register the bike with feasible and minimal hoops to jump through for government to recognize you own it and allow you to use it on public roads... But not in the oppressive police state you happen to reside in. In that case you can use the parts from the parts motorcycle (parts frame) to repair the motorcycle (frame, headstock) which the government will allow you to use. At which point you can finish restoring the bike. This is fundamentally different than taking a complete ride-able and restored bike with unknown history, no proof of or history, ownership, or reported as stolen, and changing the headstock to one from a bare frame you own with clear title in your name.