Where do ideas come from? I still do not know. However, it appears that the human mind can come up with innovations and marvels when needed.
The saying “necessity is the mother of invention” appears to be mostly true. But often, there is no direct correlation between the problem being faced and the solution which was found.
The problem can be something ‘X’. The solution which comes to mind will actually be applicable to a different problem. As long as the solution is useful and helps people solve problems, it becomes a success.