Following the Guide to Insects by Debbie Hadley I found a very nice summary about insects making galls. Aphids belonging to the subfamily Eriosomatinae (in the picture from Natura Mediterraneo) cause gall formations on the stems and petioles of certain trees, most notably cottonwood and poplar (as you can see in this video).
Aphid galls vary in shape, from a cockscomb-shaped growth on elm leaves to a cone-shaped gall that forms on witch hazel. As reported in a nice paper by David Stern, gall morphology is extremely conservative with respect to aphid phylogeny, but variable with respect to plant taxonomy. In addition, the phylogeny reveals at least three host plant switches where the aphids produce galls most similar to the galls of their closest relatives, rather than galls similar to the galls of aphids already present on the host plant. These results suggest that aphids determine the details of gall morphology essentially extending their phenotype to include plant material. Based on this and other evidence, Stern suggested that the aphids and other galling insects manipulate latent plant developmental programmes to produce modified atavistic plant morphologies rather than create new forms de novo.
Galls occur more frequently on the winter hosts, which usually are trees. Galls occur in the spring after overwintering eggs hatch. Two to several generations of aphids develop in the gall, after which winged adults leave the gall in search of summer hosts. As reported for other insects, the benefits of living inside a gall range from reduced predation and protection from inclement weather to enhanced nutrition and fewer microorganisms to infect them.
After aphids leave the gall, galls remain behind on the host plant and other insects, such as beetles (as reported here) or caterpillars, may move into the gall for shelter or to feed.
D.L. Stern (1995). Phylogenetic Evidence that Aphids, Rather than Plants, Determine Gall Morphology Proc. R. Soc. Lond. B, 1357, 85-89 DOI: 10.1098/rspb.1995.0063