It's my understanding that once a disc comes to rest that's your lie. If the disc subsequently moves you put it back where it came to rest. So if a wedgie popped out after coming to rest you would replace it in the entrapment device and then remove it to complete the hole. This is the same interpretation that say that a disc stuck above 2m in a tree is still considered to be above 2m subject to the rule even if it falls while you're walking up to your lie. Otherwise if your disc landed next to the basket and a fluke wind picked it up and flipped it in the basket it would count. The rule you quote is defining when the hole is over not how to count your strokes. For instance if you crack a beer after sinking your putt on the last hole if you do it before you remove the disc it's still during the round and you're DQ if you remove the disc first it's after the round and you're legal. There are other rules that can come into play differently if it's during the hole as opposed to after the hole has been completed as well.
802.02 Establishing position:
If the thrown disc has moved after it first came to rest on the in-bounds playing surface, it shall be replaced to its approximate position. If it first came to rest elsewhere, the disc need not be replaced, and any determinations are made relative to where it first came to rest.