Basically in determining the holding the ball rule, all that matters is prior opportunity. If the umpire determines you've had prior and you get tackled, you have to immediately dispose of it. If the umpire determines you haven't had prior and you get tackled, you have to make a genuine attempt to dispose of it.
If the ball comes loose or is dropped in the tackle, it doesn't matter, unless the ump determines that when it came loose you had an opportunity to handball or kick.
It's not always adjudicated properly but that's how they mean to do it. You get tons of people whinging every tackle that "he dropped it!" But that doesn't matter. All that matters is prior opportunity and making a genuine attempt.
Well, you see...for a hundred years, once you got tackled and the ball came loose...it was deemed incorrect or a throw. Nowadays it is judged either by how many seconds it took for you to have gotten tackled, or the side you are playing against has the favour of the media that current week, or if one arm is pinned. Once the tackler has pinned one of your arms the 'prior' become inadmissible