Just because you learn more from failures doesn't mean that you will learn more in aggregate over time with more failures. If you fail too much, your brain will tell you that it's better to quit and spend your attention/time in another way.
Elon Musk recently said it well. He said something along the lines of always assuming you are wrong. The goal is to try to be less wrong all the time. Which is basically what good science is. And that guarantees long term improvement and success. So you need to fail a little to learn and get better. If you always succeeded, I think you'd never really know why you succeeded which is important knowledge and guarantees to a certain degree not making those mistakes again in the future.