The Church arrives at a doctrine by looking at what the scripture says and what we can glean from the consensus of the fathers. We do not necessarily expect a doctrine to be found in the scripture already formulated in one passage or a collection of passages. At some point, under the guidance of the Holy Spirit, the understanding emerges that this, and not that, is what the Apostles taught; this is the authentic doctrine.
The hermeneutics are that words of Christ are given heavier weight than other content; that literal reading is preferred unless it can be easily impeached (”I am the door” doesn’t sound like literal meaning because there are several other metaphors in adjacent passages, that cannot all be literal); that innovative reading that is not detected historically is ipso facto suspect.
Both immediate context and passages from other parts of a book, or from different books can be relevant if they treat the related subject. For example, the promise to “the woman” that her seed will crush the Serpent in Genesis is relevant to Mariology which of course is concentrated around passages in Luke and John. So no, we should not limit ourselves to the immediate context.
Okay, understood. Back to your question...
“If we have no real choice in how we behave, why does the scripture teach us how to behave?”
There are two problems with this question. First, It may become a trick question, similar to “Can God make a rock bigger than He can pick up?” The problem is you have asked and answered it. It anticipates no other answer possible, beyond the obvious.
But, as we agreed before, the obvious answer is not always what the Scriptures provide.
Second, you are connecting admonitions about behavior to proof of “free will”. After all, if man is asked to do something, it must imply ability to do it. Otherwise God wouldn’t have asked. Thus, it rests upon a man’s will alone to obey or not. Correct? But, whether you are aware of this or not, such a perspective is Pelagianism.
Pelagius argued (beyond his error in rejecting original sin and other spurious concepts) against Augustine’s prayer that God “...ask what He would and grant what he asked”. Pelagius argued exactly what you are arguing. He agreed with Augustine that God could ask what ever He wanted, but that it would be absurd to have God ask something that we could not accomplish. You are doing the very same thing. You question, “If we have no real choice in how we behave, why does the scripture teach us how to behave?” is a Pelagian question.
I am aware that you are saying this is not Pelagian because grace is needed to accomplish obedience. But you then add that universally granted grace is already available to men sufficient to allow them to obey or reject. This is essentially what Pelagius argued.
Since all believers rejected Pelagius back when he was alive (350AD), it is curious that most Evangelicals and Catholics have now re-adopted his views. We reject that all things God commanded are possible, irrespective of the number of times He commands them. Why? Because, as the Law is a tutor to lead us to see the need of grace poured upon our failure, all obedience is managed and driven by God’s Spirit working in us for His good pleasure.
We are to try, exert, choose, act, think, behave, obey, comply, and all the other verbs you can think of. But, and this is a big “but”, God must be actively working in our wills and lives for us to even be wanting to do any of this. Our wills are in bondage to Him, they are not free. He opens eyes to see and energizes hearts to believe. The commands to obey are simply to demonstrate that what you thought was possible (obedience) is not.
If you wish to read many passages about God controlling the will of man, I will list those. But, I sense you are not persuaded by their content.