Why did you doubt? This was the question Jesus asked Peter. Faith is a gift from God and we are to measure ourselves according to the faith God has given us (Rom 12:3). We are not to boast of our strong faith. It is not how much faith we have that gets us saved, but in the object of the faith, God has given us--our faith is given, not achieved. Faith comes by the Word of God (Rom. 10:17). If faith were knowledge, we would be saved by knowledge. For salvation, we don't "think so" or "know so" but "believe so." God wants us to "know" in a biblical sense, basing our faith on the Word of God and not experience. John writes in 1 John that he wants his readers to "know" they are saved. "I write these things to you who believe in the Son of God, that you may know that you have eternal life" (1 John 5:13). God doesn't require perfect faith but sincere and unfeigned faith (cf. 1 Tim. 1:5; 2 Tim. 1:5).
The "believers" who Christ disowns in Mat 7:21 are those who placed their faith in their deeds, not in Christ. "Did we not prophesy in your name?" People that say they know, that they know, that they know, are basing their "knowledge" on experience and their walk with Christ. Let us not confuse our walk and our salvation or our justification with our sanctification. Faith is indeed having assurance, but doubt is an element of faith not the opposite of it. "I believe, help thou mine unbelief," (cf. Mark 9:24)."
I have doubted my salvation in the past but I never doubted the person and work of Christ or the conviction of my sins and the truth of the gospel message itself, and I would not say I have become a Christian only recently because of my renewed faith. Assurance comes from righteousness according to Isa. 32:17. The closer we walk with Christ, the more assured we become and our faith grows. We go from faith to faith per Rom. 1:17. Soli Deo Gloria!