Have you ever gone to school in your life?
Did the teacher ever teach you a new math equation and then go on to show you multiple examples to make sure you understood the concept?
What happened after that? Did he just walk away, or did he give you an exercise or homework to practice?
Then look at the scripture as the concept the teacher (God) is teaching. He then goes on to explain through multiple chapters (examples) to make sure you grasp the idea. How then shall He know you have grasped what He has been teaching without testing you?

Look at temptation that way. It’s not that the teacher gives it to you to fail. No. The teacher wants to ensure you have not only understood but can practice the concept on your own, even in their absence. God wants to ensure that you can stand even on your own in your thinking and doing.
As a teacher introduces the concept, he will give you a simple exercise. He cannot set a very complex assessment when you haven’t covered those complex topics. Even so, God cannot allow you to be tempted more than you can bear.
As it is written by Paul in 1 Corinthians 10: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.”
The teacher only allows what you can handle, and indeed even within the exam (temptation), God still provides a narrow gate for you to escape.
Why then do you complain within, sometimes, that He is irrational?
Surely experience is the best teacher.
And just like the teacher can only be sure you are an excellent student after you have passed the test, so does God expect you, His child, to pass the tests and graduate a victor and excellent student.
If the world gifts those who are excellent in school, how much more do you think the Father can gift an excellent son?
There is reward for every temptation you overcome, but also the higher you go, the harder the tests become. And only by overcoming do you come out a victor, not by whining and complaining, not by crying, neither by self-pity nor anger, but by the Spirit and Word of God.
And these two tools are just always right next to you. But how often do you even use them?
Indeed I have done all good and overcome most temptations. But why would God even allow Satan to triumph over us sometimes?