The story of mantis shrimp molting illustrates an important point about evolution in general: evolution does not “design” or necessarily find the “best” solution to a problem. Natural selection simply selects from among the variants that exist in a population, preserving the better variants for surviving and reproducing in whatever environment the organisms happen to inhabit at the time. Over the course of many generations, these layers of history build up, writing themselves into the animals’ genes — and that history constrains what sort of variants might arise in a population in the future. Evolution never gets to work with a blank slate — it always has to work within the constraints set by the organisms’ history.
The idea of evolutionary constraint is a bit like the rules of Scrabble. In Scrabble, you don’t get to choose the letters you’d need to spell KATYDID just because you see a place on the board where it would fit perfectly — you don’t get to “design” or plan ahead. Instead, you have to work with the letters that you have drawn randomly and the letters you have “inherited” from your last turn. In other words, you are constrained. And if you draw the letters Q and Z, you have likely picked up some “baggage” that will follow you around through several turns. This baggage may wind up being a great opportunity (if you happen to wind up in a position to spell QUIZ on a triple word score) but it will also constrain your options for several turns.
Mantis shrimp can’t change their history. They are arthropods and have inherited the features of arthropods (like exoskeletons and molting) for better and for worse. However, within the constraints of their past (they’ve got to molt), natural selection can increase their fitness — in this case, by selecting for genes that encode useful behaviors.
And mantis shrimp are not alone. All life evolves, and so, all life bears the scars of its history — including humans. Our awkward wisdom teeth and appendix are simply historical holdovers that evolution has not managed to rid us of. Just like mantis shrimp and the rest of the living world, our own evolutionary history has written itself into our genes, bodies, and behaviors.