Each carbon is identical, they all have four valence electrons, so they can easily bond with other carbon atoms to form long chains or rings. In fact, a carbon atom can bond with another carbon atom two or three times to make double and triple covalent bonds between two carbon atoms.
What the larva and pupa stages have in common is that both stages take place in water. This is where the insect evolves until it becomes fully grown and then leaves water.