All our reasoning, logic, deductions, Science, Philosophy, eureka moments, Aha! moments, etc. are based on a feeling of confidence that we are "thinking correctly", we are "reasoning correctly", we are following "logical steps". But how do you know that? Well, you claim "I remember (memory) that I just had a sound, logical reasoning and now I feel confident about it". But, how do you fundamentally know that you really had a valid, sound, logical reasoning? Because you remember you did so? What if your memory is flawed or manipulated? Your feeling of confidence? What if an evil genius is making you feel like that? How can you be so sure that your thoughts are trustworthy? Can you really trust your inner dialogue? Can you really trust natural language? In fact, how do you even know that you can understand this question I'm just typing right know? Because you are experiencing a feeling of understanding in your conscious awareness? What if that feeling is just an illusion as well?
The feeling of having a rational thought is an emotion. It is confidence itself.
Like any other emotion it can be shaped incorrectly by biology or experience. But that does not make it an illusion unless it is wrong.
If it were wrong as a matter of course, most of the time, we would have died out as a species long ago. But of course, faith that we have not died out, and that you are actually here with other humans requires confidence in sensory information.
You can have confidence in your thoughts because you simply do. Even if you lack confidence in your thoughts, you have confidence in your lack of confidence. This is the basic fact of Existentialism: that we have an authentic experience of knowing what we know, and that arguing with it is nonsense because we are doomed to believe it anyway.
We can shape and train our sense of confidence, like most of the rest of our emotional responses, through exercise and experience. But it will not go away, and doubting it absolutely, instead of playing with it and developing it, is just evading responsibility for taking care of it properly.