Butterflies dissolving is an urban legend. They don't dissolve. Caterpillars have wing stubs inside them.
Someone probably cut open a chrysalis and saw goop come out, so they assumed it was just a bag of goop. But goop would also come out of a cut open caterpillar, or a cut open butterfly, or a cut open human.
They do kind of dissolve; we have better imaging now and can watch.
What isn't true is that it completely dissolves. There are parts that don't and are part of the rescaffolding process. One of those bits that does not completely dissolve is a chunk of the brain; it is probably via this that memory persists through the metamorphosis.
Wing stubs are present from the beginning as well as you noted.
Someone probably cut open a chrysalis and saw goop come out, so they assumed it was just a bag of goop. But goop would also come out of a cut open caterpillar, or a cut open butterfly, or a cut open human.