You're assuming a conclusion, i.e., that the tree could produce fruit. The better analogy would be that the person only knew he had a tree and did not know if it was a fruit-producer or not. Paul says to check this. If it is a bad tree, then you can do anything to the soil you want, but it still won't produce fruit. The only way to turn a bad tree into a good one is faith.
If good works were a fruit of already obtained salvation it would not make sense for St.Paul to spend the second half of every letter of his on fruits.
It makes perfect sense. Paul knew that the worst position possible to be in is that of a false believer (honest non-believers are in a much better position). He ministers heavily to false believers because they are in the greatest need.
Still doesn’t make sense. If a tree cannot produce a fruit at all, there is no point in giving any gardening advice. If a tree under some conditions can produce a fruit, then again the concentration would be on these conditions and not on what the fruit is like.
The natural conclusion form this observation is what the Church teaches, that works done in the spirit of love (or charity) cooperate with grace and produce salvation. Since works is something man is at liberty to do or not do, it becomes important to Paul to urge them. Works is the gardening act, that cooperates with grace,— sun and soil. Fruit is salvation. Simple and biblical, no exegetical contortions needed.