Thor didn't know there was an Infinity Stone in that scepter until he had the vision. Thanos is the one who (foolishly) gave it to Loki. Thor had no right to claim it any more than SHIELD did but an argument could be made that he should have taken it anyway.