Stalagmites and stalactites are also formed by the dissolution of calcium carbonate. When water drips from the ceiling of a cave, it can leave behind a deposit of calcium carbonate. Over time, these deposits can grow into stalactites (which hang from the ceiling) and stalagmites (which grow up from the floor).
So, the answer to your question is: all of the above. Carbon dioxide in soil can dissolve water and help form caves, stalagmites, and stalactites.