If you transfer your old TCU to the new (or rebuilt) Mechatronic (valve-body portion), then no Dealer-only reprogramming is needed, but you probably need to have the calibration routines performed, which can be done at a Dealer, or with a clone PIWIS, Autel, or Launch scan-tool. The calibration routines would be needed if the new Mechatronics does not operate smoothly (shifts, clutch engagements/disengagements).
If a new TCU is installed, then a programming of the VIN, into the new TCU, is needed, as that is tied to the anti-theft system. I believe, only a dealer can do that.
The repair kit (which is only the two black interconnect boards) is expensive if a genuine kit is purchased (like what ECS sells), but much cheaper if aftermarket/clone kits are bought (like on Amazon or Ebay). If you are willing to take the risk that you may need to repeat the board replacement process, if a cheaper board fails, then it might be worth trying the cheaper board kits before I would try replacing the Mechatronic valve-body unit. Pulling the Mechtronic out, to replace the board, or replace the valve-body section is not a major undertaking for a mechanically inclined person, but following the instructions is critical to prevent damage to the ribbon cable that runs to the circular electrical connector that passes thru the transmission case. Of course a lift makes the job much easier, but I have heard people doing this on ramps too.
I think earlier DL501 transmissions had more issues with the black interconnect boards, like DTCs related to open circuits, or implausible clutch fluid temperatures, open electrical circuits of the solenoid valves, or open or implausible input speed sensors. The later production of these boards were improved to be more durable.
But if your DTCs are like clutch pressure too high/low, or "adaptations limits" exceeded, or mechanical "blockage" type of faults, then it is more likely a problem with the Mechatronic valve-body section. I don't think the TCU itself is a typical failure area.
One last area of issues are with the position sensors on the Mechatronic, which sense the position of the shift-forks. These sensors are opposite a small magnet which is part of the shift fork. Small ferrous magnetic particles, in the fluid (normal) can "stick" to these magnets, which can make the sensor read an inaccurate position of the shift fork, thereby causing DTC codes related to mechanical shift fork positions. The fix for these is to remove the Mechatronic unit, and wipe the magnetic particle sludge off of the ends of the four shift forks.
I think 99% of DL501 problems are with Mechatronic issues. The rest of the transmission is pretty robust, consisting of a 7 speed gear-box, and an oil-pump, and the dual-clutch assembly. There is one more electronic item inside the gear-box section, the "Gear Selector/Drive Range sensor, and the gearbox input speed sensors", but that rarely fails in later production DL501 transmissions. (This sensor does fail more often in the PDK of the 911, but that is a different transmission design/manufacturer).
Concerning a used DL501 transmission, that would be a last resort, but be aware that the DL501 fitted to the Macan had two different transmission cases, one for Porsche V6 engines, and a different one for the 2.0 4-cylinder and Audi V6 equipped Macans. This is because the engine bell-housing bolt patterns are different.
One risk with a used DL501 is that the wear condition of the dual-clutch may be unknown.