Thank you so much I spend like 2 hours just trying to figure out why it wasn't working. I'm newer to datapack creation so I wasn't aware that load.json was trigger before the actual world was loaded in. I'll try this and see how it works.
[Edit] Just did a little bit of testing and everything seems to work properly