How to replace some trees of certain type when growing?

I am wanting to make around 10% of trees grown by saplings be replaced with a structure block with a slightly modified tree inside

What I want to know is:

  1. How to detect when any sapling grows
  2. How to use random chance
  3. Use structure blocks in a datapack (I know how to use them, but unsure how it works into datapacks)

Eventually I want this to work with world generation, but I figured saplings would be an easier place to start

P.S. I have no idea how events work, or how they trigger .mcfunctions (I was thinking of using a command to set the structure block)

Continue to help post