You can never spawn under a tree when loading into a world, even though I believe there is a parameter to check for blocks that also excludes leaves, called "surface no leaves" or something.
To reproduce, load a bunch of single biome Dark Oak Forest worlds and observe how you always have no blocks above you, and that you sometimes end up on top of one of the trees.
Related issues
Comments

Duplicate of MC-242348; those are some simple reproduction steps, and that report would benefit from having them.