When you cut the black trunk, did the black go all the way through the cross section? Some of my avocados turned black this summer and I panicked, but I found out they sunburn like that.
The leaves falling off may or may not be related -- a lot of the leaves brown and fall in the winter I think due to lack of humidity and also lower than optimal temperature to maintain green.
And the black bugs in the soil may or may not be related.
At a guess, though if they are all related, the avocado may have suffered root rot due to sitting in water too long/overwatering? If this was the case, cross section of the cut would have sown brown/blackened interior.
Your use of cinnamon suggests you suspect fungus gnats. If that Swheat they are, they are a symptom rather than the cause -- i.e. they're not really attacking the avocado.