Matt 10:22 disagrees with your assessment of when ne actually gets saved.
(Mat 10:22) And ye shall be hated of all men for my name's sake: but he that endureth to the end shall be saved.
Surrounding context of this verse is about deliverance from persecution and trials during end times. This is not a verse about being given eternal life.
Surrounding context:
Mat 10:21 And the brother shall deliver up the brother to death, and the father the child: and the children shall rise up against their parents, and cause them to be put to death.
Mat 10:23 But when they persecute you in this city, flee ye into another: for verily I say unto you, Ye shall not have gone over the cities of Israel, till the Son of man be come.
The purpose of the book of John is to show people they can have eternal life and it is by believing on the Lord Jesus Christ for forgiveness of sin and to be given eternal life. John 3:16, 3:36, 5:24, 8:40, 10:28
And before we go to 'faith without works is dead' in James 2. The surrounding context of that is people who already have faith and what they do with it. Abraham, Rahab.. etc.. used the faith they had for God to do His will. Not that if they didn't work.. they would lose eternal life.. not that they never had eternal life. THE faith... ie bible study, fellowship, sharing your faith etc.. daily faith.. is lifeless.. dead without works.
Not that they never had faith or lost eternal life! Look at the faith examples in James before taking the one verse on it's own.