Why anyone does anything is hid, figuratively, in a person's kidneys. Motives are naturally hidden. So it is always wise to sort of "hedge" one's answers to "why" questions. In fact, whenever my sons would ask me "why" I would say, "I can't answer any why questions". I mean, I could say why I might do something but it is somewhat presumptuous to think you can know someone's motives by their actions.
In fact, it is suggested in scripture that the secrets of men's hearts are hid even from God (by God's design of course) perhaps to give people some privacy. To discover what is in people's hearts God devises tests:
[Gen 22:12 KJV] 12 And he said, Lay not thine hand upon the lad, neither do thou any thing unto him: for now I know that thou fearest God, seeing thou hast not withheld thy son, thine only [son] from me.
The LORD new that David was more qualified than his brothers because he looked at his heart:
[1Sa 16:7 KJV] 7 But the LORD said unto Samuel, Look not on his countenance, or on the height of his stature; because I have refused him: for [the LORD seeth] not as man seeth; for man looketh on the outward appearance, but the LORD looketh on the heart.
So how did God know his secrets? He set up a couple of tests and when Saul heard of his demonstrations of faith-induced courage, Saul was also "sold" on David:
[1Sa 17:32-37 CSB] 32 David said to Saul, "Don't let anyone be discouraged by him; your servant will go and fight this Philistine! " 33 But Saul replied, "You can't go fight this Philistine. You're just a youth, and he's been a warrior since he was young." 34 David answered Saul: "Your servant has been tending his father's sheep. Whenever a lion or a bear came and carried off a lamb from the flock, 35 "I went after it, struck it down, and rescued the lamb from its mouth. If it reared up against me, I would grab it by its fur, strike it down, and kill it. 36 "Your servant has killed lions and bears; this uncircumcised Philistine will be like one of them, for he has defied the armies of the living God." 37 Then David said, "The LORD who rescued me from the paw of the lion and the paw of the bear will rescue me from the hand of this Philistine." Saul said to David, "Go, and may the LORD be with you."
This is why the scriptures frequently speak of:
- "trying" (putting to a test) the "hearts and kidneys":
[Psa 7:9 KJV] 9 Oh let the wickedness of the wicked come to an end; but establish the just: for the righteous God trieth the hearts and reins.
[Pro 17:3 KJV] 3 The fining pot [is] for silver, and the furnace for gold: but the LORD trieth the hearts.
[1Th 2:4 KJV] 4 But as we were allowed of God to be put in trust with the gospel, even so we speak; not as pleasing men, but God, which trieth our hearts.
The scriptures speak of the "fiery trials" by which one is vindicated:
[1Pe 4:12 KJV] 12 Beloved, think it not strange concerning the fiery trial which is to try you, as though some strange thing happened unto you:
[Psa 7:9 KJV] 9 Oh let the wickedness of the wicked come to an end; but establish the just: for the righteous God trieth the hearts and reins.
[Psa 26:2 KJV] 2 Examine me, O LORD, and prove me; try my reins and my heart.
[Jer 11:20 KJV] 20 But, O LORD of hosts, that judgest righteously, that triest the reins and the heart, let me see thy vengeance on them: for unto thee have I revealed my cause.
[Jer 17:10 KJV] 10 I the LORD search the heart, [I] try the reins, even to give every man according to his ways, [and] according to the fruit of his doings.
[Jer 20:12 KJV] 12 But, O LORD of hosts, that triest the righteous, [and] seest the reins and the heart, let me see thy vengeance on them: for unto thee have I opened my cause.
[Rev 2:23 KJV] 23 And I will kill her children with death; and all the churches shall know that I am he which searcheth the reins and hearts: and I will give unto every one of you according to your works.
However, in the messianic age the secrets of men's hearts are revealed by God to the messiah:
[Jhn 6:64 KJV] 64 But there are some of you that believe not. For Jesus knew from the beginning who they were that believed not, and who should betray him.
[Jhn 5:42 KJV] 42 But I know you, that ye have not the love of God in you.
[1Co 14:24-25 NKJV] 24 But if all prophesy, and an unbeliever or an uninformed person comes in, he is convinced by all, he is convicted by all. 25 And thus the secrets of his heart are revealed; and so, falling down on [his] face, he will worship God and report that God is truly among you.
God's own heart is revealed directly to his apostles by the shared breath/spirit:
[1Co 2:9-16 NKJV] 9 But as it is written: "Eye has not seen, nor ear heard, Nor have entered into the heart of man The things which God has prepared for those who love Him." 10 But God has revealed [them] to us through His Spirit. For the Spirit searches all things, yes, the deep things of God. 11 For what man knows the things of a man except the spirit of the man which is in him? Even so no one knows the things of God except the Spirit of God. 12 Now we have received, not the spirit of the world, but the Spirit who is from God, that we might know the things that have been freely given to us by God. 13 These things we also speak, not in words which man's wisdom teaches but which the Holy Spirit teaches, comparing spiritual things with spiritual. 14 But the natural man does not receive the things of the Spirit of God, for they are foolishness to him; nor can he know [them], because they are spiritually discerned. 15 But he who is spiritual judges all things, yet he himself is [rightly] judged by no one. 16 For "who has known the mind of the LORD that he may instruct Him?" But we have the mind of Christ.
The Satan is much more complex a character than many realize. He's not a serious "rival" to God so much as an overly zealous and corrupt "District Attorney" in God's economy. He is his own "Devil's Advocate". He is used by God to test people and reveal the secrets of their heart:
[Mat 4:1-3 NKJV] 1 Then Jesus was led up by the Spirit into the wilderness to be tempted by the devil. 2 And when He had fasted forty days and forty nights, afterward He was hungry. 3 Now when the tempter came to Him, he said, "If You are the Son of God, command that these stones become bread."
Obviously Jesus passed with flying colors. Others not so much:
[Luk 8:13 NKJV] 13 "But the ones on the rock [are those] who, when they hear, receive the word with joy; and these have no root, who believe for a while and in time of temptation fall away.
Job had to have a handicap. He was shielded by a divinely established "hedge" so that the Satan could not test him beyond his ability:
[1Co 10:13 NKJV] 13 No temptation has overtaken you except such as is common to man; but God [is] faithful, who will not allow you to be tempted beyond what you are able, but with the temptation will also make the way of escape, that you may be able to bear [it].
But the question is about the nature of the hedge. Again, this is speculative but since a "hedge" is type of bush often planted to protect a garden it seems extremely fitting to look in that direction:
...It is a subject of much conjecture as to what plants are most reliable for repelling pests. But, regardless of which plants you use, the principle of design is the same. To design a garden with plants that repel snakes, you will need to employ three key elements: a snake barrier, a variety of deterrent plants, and a lacking food source. Snakes eat mice, rats, and other small animals. Therefore, if your garden is unattractive to these critters, it will be unattractive to snakes. Using one, or multiple plants listed below, plant a hedge barrier around the perimeter of your garden. What’s more, he more rows of barrier plants, the more effective they will become. For example, a barrier row of onions is fine; a barrier row of onions and garlic is better; and a barrier row of onions, followed by garlic, followed by tobacco is great...

Of course, the hedge is just a physical metaphor for God drawing limits on his designs.