If it is OK with you, I'd prefer to skip over the commentary on Luther and focus directly on the scripture presented in the OP:
Matthew 7: 18-20.
18 “A good tree cannot bear bad fruit, and a bad tree cannot bear good fruit.
19 Every tree that does not bear good fruit is cut down and thrown into the fire.
20 Thus, by their fruit you will recognize them.
This doesn't seem all that complicated of a verse to me. Sinners commit sins and the saved serve God. So saved people (good trees) will do the things that God commands (bear good fruit), and unsaved people (bad trees) cannot do the things that please God, because they are busy doing all of the things that oppose the will of God.
This seems sort of self-evident. So what does this have to do with sotierology (the process by which God transforms sinners into saints)? I see nothing in these verses on that topic at all. Merely blunt statements about the fundamental difference between the saved and the unsaved.
21 “Not everyone who says to me, ‘Lord, Lord,’ will enter the kingdom of heaven, but only the one who does the will of my Father who is in heaven.
22 Many will say to me on that day, ‘Lord, Lord, did we not prophesy in your name and in your name drive out demons and in your name perform many miracles?’
23 Then I will tell them plainly, ‘I never knew you. Away from me, you evildoers!’
"I never knew you" (Matthew 7:23) seems to be the money verse in that whole exchange. How can someone that Jesus NEVER KNEW be saved. There is no salvation apart from Jesus and his death on the cross and ressurection from the tomb. No Calvinist or Wesleyan or Roman Catholic or Eastern Orthodox or any of the orthodox flavors of Protestantism that I am familiar with believe in a salvation apart from Christ. By Jesus' statement of supreme fiat, these people who will not enter heaven in Matthew 7:21-23 were and are always unsaved. How do they apply to sotierology?
24 “Therefore everyone who hears these words of mine and puts them into practice is like a wise man who built his house on the rock.
25 The rain came down, the streams rose, and the winds blew and beat against that house; yet it did not fall, because it had its foundation on the rock.
26 But everyone who hears these words of mine and does not put them into practice is like a foolish man who built his house on sand.
Is there any evidence that someone can be saved by "hearing" Jesus' words but not doing them? Were the "brood of vipers" saved when they heard and objected? I think your verse from James does a great job of dealing with this exact situation. James says they have a "dead faith" that cannot save them. That makes those who hear, but do not do unsaved.
14 What does it profit, my brethren, if someone says he has faith but does not have works? Can faith save him? 15 If a brother or sister is naked and destitute of daily food, 16 and one of you says to them, “Depart in peace, be warmed and filled,” but you do not give them the things which are needed for the body, what does it profit? 17 Thus also faith by itself, if it does not have works, is dead."
This is the key. There are two types of faith. One type of faith the person hears, repents, and follows. Then there are the devils who believe that Jesus is the Christ and tremble in fear. If justification does not lead to sanctification, then Scriptire warns us over and over to be very worried about our so-called justification.
If you "graft" a branch on the TRUE VINE and it begins to bear fruit, the graft was probably successful. If you "graft" a branch on the TRUE VINE and it continues to wither and die and bears no fruit, then maybe you want to double check that it was grafted to the right VINE.
37 And he said to him, “You shall love the Lord your God with all your heart and with all your soul and with all your mind. 38 This is the great and first commandment. 39 And a second is like it: You shall love your neighbor as yourself. 40 On these two commandments depend all the Law and the Prophets.”
When Adam and Eve had only two children, one killed the other. People are incapable of obeying those two simple commands in our fallen state. Only AFTER sanctification is it possible.
Ezekiel 36:25-27 NASB
25 Then I will sprinkle clean water on you, and you will be clean; I will cleanse you from all your filthiness and from all your idols. 26 Moreover, I will give you a new heart and put a new spirit within you; and I will remove the heart of stone from your flesh and give you a heart of flesh. 27 I will put My Spirit within you and cause you to walk in My statutes, and you will be careful to observe My ordinances.
God makes the first move and empowers us to obey.
Ephesians 2:1-10 NASB
1 And you [fn]were dead [fn]in your trespasses and sins, 2 in which you formerly walked according to the [fn]course of this world, according to the prince of the power of the air, of the spirit that is now working in the sons of disobedience. 3 Among them we too all formerly lived in the lusts of our flesh, [fn]indulging the desires of the flesh and of the [fn]mind, and were by nature children of wrath, even as the rest. 4 But God, being rich in mercy, because of His great love with which He loved us, 5 even when we were dead [fn]in our transgressions, made us alive together [fn]with Christ (by grace you have been saved), 6 and raised us up with Him, and seated us with Him in the heavenly
places in Christ Jesus, 7 so that in the ages to come He might show the surpassing riches of His grace in kindness toward us in Christ Jesus. 8 For by grace you have been saved through faith; and [fn]that not of yourselves,
it is the gift of God; 9 not as a result of works, so that no one may boast. 10 For we are His workmanship, created in Christ Jesus for good works, which God prepared beforehand so that we would walk in them.
We were dead, God makes the first move, then we are empowered to do good works.