At first look many will read "so and so happened that the scripture might be fulfilled", as meaning a specific act was performed to match a prophecy. You write down yesterday that the person who answers your question will be named Steve, so I change my screen name to Steve to *Fulfill what you wrote.
As with many sayings, idioms, etc., from antiquity, or from different languages and cultures, we have to transpose and adjust with care. I know *you know that - I'm speaking about those who carelessly draw immediate conclusions without proper deliberation & knowledge.
Think about this
John 8:48 The Jews answered him, “Are we not right in saying that you are a Samaritan and have a demon?”
No one talks like this. And.....
We have one Father—even God,.... or truly truly I say to you.
When we read that the scripture might be fulfilled, as in the quote about Judas, and in many cases we are hearing,...
This was not a surprise. Nothing went wrong. There is no contingency plan in the works to adapt to this unseen turn of events. That's what- so the scripture would be fulfilled means in so many cases and is a kind of *Short form way of saying it.
Acts 2:23 this Jesus, delivered up according to the definite plan and foreknowledge of God, you crucified and killed by the hands of lawless men. 24 God raised him up, loosing the pangs of death,.... 25 For David says concerning him,......
And again in Acts 4
“Sovereign Lord, who made the heaven and the earth and the sea and everything in them, 25 who through the mouth of our father David, your servant, said by the Holy Spirit,
“‘Why did the Gentiles rage,
and the peoples plot in vain?
26 The kings of the earth set themselves,
and the rulers were gathered together,
against the Lord and against his Anointed’[e]—
27 for truly in this city there were gathered together against your holy servant Jesus, whom you anointed, both Herod and Pontius Pilate, along with the Gentiles and the peoples of Israel, 28 to do whatever your hand and your plan had predestined to take place.
Christ' death was so the scripture could be fulfilled. Meaning...
6 It is not as though God’s word had failed. For not all who are descended from Israel are Israel.
Messiah dying was not what the Jews thought. Nothing went wrong. His apostles were not left picking up the pieces of a failed mission. God's Word has not failed. The Scriptures were Fulfilled and that's why they included this saying many times in the New Testament.
Jesus was not only explaining to Pilate, but Matthew was explaining to the Jews & to us, the readers, that Christ was the Lamb, slain from the foundation of the world. Jesus was saying "if I stop you now with my power, I'm fighting against Myself ! This is My Plan."
Judas and his actions, like all of our actions are known by Almighty God before any of them come to be. (Psalm 139). Like Herod & Pilate, God weaves together our free actions, who we are, and what our free choices make us, to accomplish his purpose. It is not so the scriptures can be fulfilled in some kind of put up job, it just means God's Plan has been announced beforehand and He's not just winging it.