The Bug
As supposed to any other sapling or big mushroom, crimson and warped trees do not check for empty space when growing.
This means their height is not defined by blocks above and growing never fails, even if there is an insufficient amount of space.
Steps to Reproduce
Place a warped or crimson fungi
Place bocks above it
Bone meal the fungi.
→ ❌ Tree will grow disregarding any blocks above
They can even grow through the bedrock ceiling of the nether, leading to stray trees sometimes appearing above the world.