Why Pistons do this - Detroit needs a second scorer and three-point shooting. Kyrie adds tons of scoring to a young Pistons team, and Naji gives them a 3-D wing. They lose Jaden Ivey, who they probably aren't resigning, Tobias is a better 3pt shooter than Naji, but not by a ton. Naji also fits better within the Pistons' timeframe than Harris. Naji is on a very reasonable deal which doesn't put the Pistons in cap hell when they come to sign Duren. The Pistons lose a young player who could become a monster in Holland. They also lose some late 1st rd picks and give the Mavs their 2nds back.
Why the Mavs do this - Holland is the big prize for the Mavs here. A 3-D wing with good length and defense, the potential to develop good 3-point range, and the ability to improve as a rebounder. He's 20 so he fits the Flagg rebuild timeline. Ivey could be someone the Mavs sign, but they may let him walk for the cap space. Harris will walk in the offseason and creates more cap flexibility. Mavs stockpile a couple of late firsts and get their 2nds back to help draft more youth for the Flagg era.
Hate seeing Kyrie leave, but the Mavs gotta think about the future and Flagg is the future.