The issue of how Jesus in John 10:34-35 interprets Psalm 82 is complicated. It encroaches some on my posts about the historical Jesus. I am pretty sure none of my seminary professors thought John’s gospel had any historical value at all. I remember one of them urging us to remove the passage about the marriage feast at Cana from the marriage ceremony because it was unhistorical. This leaves me agnostic about the question. So I am going to speak of John’s interpretation of the psalm, not that of Jesus.
John reflects the (to us) rather odd methods of Jewish scripture interpretation in Jesus’ day. We know something about these methods from the Dead Sea Scrolls, Rabbinical traditions, and Philo. The interpretation seems to be a madrash. Midrash expands upon the wording of scripture in order to answer a question that has come up in the present. In John 10 the question is whether Jesus commits blasphemy by assuming prerogatives of God.
John claims that God “called them gods to whom the word of God came.” referring to Psalm 82:6. Now Psalm 82 does not say that the gods there are “those to whom the word of God came.” So John is making a leap. He expands on the scripture. This is the madrash.
Perhaps John took the scene in Psalm 82 to go back to the giving of the law at Sinai. This law the people did not follow, so calling them gods is ironic or perhaps even sarcastic. But if the word “god” could be mentioned in connection with them, then how much more in connection with Jesus who actually does the work of God and is going to raise Lazarus from the dead in the next chapter. As best I can make out, John refutes the charge of blasphemy that way.
You can read something about this, and get a sense of how complicated it is, in an article by Jerome Neyrey here.