Keep in mind that decomposition is for the growth and maintenance of the organisms doing the decomposing, meaning some of that carbon is incorporated into the decomposers, not released to the atmosphere. It would take years or even decades for a dead tree to release most of its captured carbon to the atmosphere. It will eventually happen, though, which is why you need a continual cycle of new growth that helps minimizes net losses due to decomposition.
It’s not perfect but it’s something and done right, which the vast majority of tree carbon credit programs are NOT, is a self perpetuating method of carbon capture.