I think this all comes down to how Kuminga plays from here to the trade deadline for market value.
The Mavs with this trade get rid of Klay, get a young piece, a floor spacer and a pick for basically Gafford while getting rid of Klay's contract which at this point is a negative asset.
Warriors get frontcourt depth but need to trust that Klay will be at least a little better than he has been this season. This move also allows gsw to then maybe move TJD and/or Gui including them with a pick and salary filler for an improvement