I didn’t know how to search the answer for my question so that’s why I created this topic.
How it happened that we have such suttas or phrases that we could have them I guess only by this way that the Buddha later told such story to monks. For example the first discourse where Buddha told some wanderer that He is Tathāgata etc.
Well, the real answer is that we don’t know.
It seems reasonable to suppose that these events may have been related by the Buddha to disciples at some point. Traditionally, all such passages were believed to have been told to Ānanda. And we have plenty of instances in the canon where events that happened at one time were later reported to the Buddha or someone else, so clearly this kind of thing did happen.
Nevertheless, there’s no real evidence that this is always the case. Probably we should assume that sometimes these may be genuine records, while in other cases, a product of a narrative elaboration.
Yes, as Ajhan Sujato says, it is uncertain if he said it. I won’t be surprised if there were ‘Bhikkhu’s’ who tried to discredit him by introducing this sutta. In all the other places he says the Tathagata cannot be found even now. He also says everything he said after he became an arahanth was correct. The single sutta you mentioned is not in line with a number of other suttas.