Those cars are, as you say illegal to operate as-is, but there are many non-running cars which would be (if certain repairs were made) perfectly legal to drive. Buying up several of these cars and assembling the best pieces is neither illegal or nefarious. Even buying a few "totaled" cars as donors for certain parts is perfectly fine as well.
Right, but that has absolutely nothing to do with what the original comment mentioned about pulling together parts from illegal cars to make one legal car.
Let's be perfectly honest, even if I put together 5 1991 Subaru Loyales to make one good one, I won't be making money because it's still only worth $2k.
On the other hand, if I can "get" a few 2009+ luxury cars and turn them into a good car, I stand to make a lot of money. I think you'll find you can't legally and cheaply get 2009+ luxury cars.
That being said, cars are often "written off" or somehow declared illegal to ever be driven on the road again once they have a certain level or kind of damage. This is done to keep everyone safer by removing vehicles that don't meet an acceptable minimum standard.
If I chop up 5 cars declared illegal for road use, and make one car from them, is it safe enough? How is that tested? Usually, people that are "re-birthing" cars are not interested in telling the new buyer the history, so nobody will even know the particular car has a questionable safety history.
Would you be happy driving your young family in a car that I welded together from other cars?