I don't think those cases are really comparable. Scandinavian countries had separate state institutions (even when countries were part of the same empire or composite monarchy) in a way that didn't apply to the former Holy Roman Empire/German Confederation which were nominally part of the same political unit and saw themselves as having much closer ethnic ties. The HRE was seen as an entirely german political entity and had almost no non-german kings in its entire history. The fact that German states jealously guarded their sovereignty does not mean they did not see themselves as fundamentally german.
Similar reasons apply to Italy. Because of the geography of the Italian peninsula a unified Italian nation state would be much more successful economically than a patchwork of small entities. Once Italy's maritime commercial decline began states had less incentive to block unification.
>> Put another way, German unification was not for the benefit of Germans, but for the benefit of Prussia.
The rest of Germany not only strongly benefited economically from german unification but also supported protective tariff policies after unification that had the effect of tying their economies much closer to Prussia (and vice-versa of course). If they didn't believe it was in their interest why in the world would they do that? If anything, the rest of the German states probably engaged in free-riding off of Prussia's military support. This once again benefits both sides.