If another branch gets more work it will fetch the blocks on it, undo the blocks on its current chain back to the point of the fork, then it applies the new blocks. If it encounters invalidity in the new blocks it marks the invalid block and any descendants as invalid which would make that branch no longer the longest, then it would undo back to the common ancestor and apply forward back up to the tip.
So your original thinking is close, except it doesn't even start fetching the data or storing it unless it would be the best chain by POW if it was also valid.