You're right about that bout defeat comes from us, we have this doubt of not being able to do it and when such happens we see ourselves failing.
Sometimes all me need to do is believe in ourselves that we can do it. Self motivation and encouragement goes a long way too.