This is a technical explanation.
In order for fungi to grow and become active, they need water, warm temperatures, oxygen and food. In a loving tree, the sapwood often contains so much water that there is no oxygen. Hence, the sapwood in the living tree is not subject to decay. In some of the pines, the sapwood can exist for up to 35 yers or more. That is, no heartwood forms until the tree is over 35 years old. So, it is very unlikely that the tree had any heartwood at all. Heartwood, due to the increased amount of chemical deposits, has a food supply (i.e., the wood itself) that in pine is somewhat poisonous to fungi. However, even though the stem was all sapwood, not all sapwood is the same...the older sapwood does not have the high moisture content that younger sapwood has and therefore has oxygen. So, old sapwood is subject to decay before it converts to heartwood. The presence of decay inside a stem is therefore seen in some pine species.
The branches of a tree do have some heartwood development early in life and this means that the central part of a branch will have some decay resistance due to the poisonous wood. This heartwood forms perhaps due to stress or perhaps due to juvenile wood. The branch heartwood is not 100% decay resistant and can be small in diameter. However, such decay resistant heartwood wood in a branch is why some branches persist on a stem long after they have died. Eventually the stem grows around them and creates the "black knots" we see in pine.