I appreciate that as I "get it" already I do have possibly a squint view of this... but what minefield is there in this regard?
there is only one question a ref (or anyone!) has to consider - who was responsible for putting the ball into in-goal last before the ball was made dead?
As for scenarios where the ball gets passed in and kicked out but charged down back in... its still a simple single question - who was responsible for putting the ball into in-goal last?"
The only minor wobble in this is when you come down to debating what constitutes "responsible" - such as a ball glancing off a defender's leg who didn't move. Which happens to infrequently as not to be worried about generally and whatever you as a ref decides in all likelihood won't be queried.