You're correct, but only if the tree's entire carbon store is released to the atmosphere, such as by being burned. Not all of the tree is able to decay and release its carbon. The portion of the organic matter that fell to the forest floor, was covered by other organic matter, stayed there for a long time and eventually becomes coal or oil. In other words, you can end up storing a lot of carbon in the soil.
I suppose one good way to sequester carbon is to plant trees then cut them down at maturity and build durable buildings out of them.