I’m not an expert, but my understanding is that the science indicates all mammals have a common ancestor. Not certain about fish, but I think that’s a similar case?
To me, the surprising part about carcinisation is that, the form of a crab seems oddly specific, but non-obvious. I mean, I look at the form of a fish and think, “yeah, it makes sense why that shape would be favored in water,” but I look at a crab and think “guess that’s just what worked out for your ancestors. Tough luck, buddy.” But apparently it’s not just bad luck, it’s a common strategy.
Relevant