Rakell for Kotkaniemi is more balanced and could actually help both sides both as a change of scenery and as a long-term play to manage the cap.
The idea is that Carolina gets the shorter contract because they don't want dead money on the books for 12 years, but Pittsburgh gets the contract with the more favourable buyout.
Pittsburgh's window is closing within the next 2-3 seasons, then they will likely have to go into a full rebuild. In a scenario where they buyout Rakell this year or next year, they are hit with cap penalties as high as 2.9M. Those penalties all come within the next 3-4 seasons. That is when Pittsburgh might try to win before Crosby retires.
With Kotkaniemi, while his buyout his longer, the cap penalties range from approx. 400k-800k. So in a scenario where they gave Kotkaniemi 1 year to turn it around and then bought him out, the cap implications in the short term are a lot more positive. Given that Pittsburgh projects to rebuild after Crosby, 10 years of dead money will be irrelevant because a rebuild that won't start 3+ years from now will take 5+ years.
From Carolina's POV, just ride out Rakell and hope he is a better fit. Consider possibly buying him out 1-2 years from now. While the cap hit is higher, it will only be on the books for a few seasons, not a dozen.