What we learn at school doesn't need to be directly applicable to what we eventually do in our careers. There only needs to be a _metaphorical_ connection. In essence, we learn how to do things that are necessary through learning metaphors.
For example, we don't learn about history in order to know what happened in the past. We learn about history so we can understand how actions have consequences, how to build rational conclusions from evidence, how humanity has (and hasn't) changed over time, and so on. History is a really good metaphor for scientific rigour and process. We don't tend to tell kids that because learning about how some ancient civilisation killed another is less "boring" than formal logic.
When it comes to learning to code, being taught how to write an application so you might be the next Mark Zuckerberg is ridiculous. The next Mark Zuckerberg is going to learn coding regardless of what they're taught in a classroom. But, that said, would learning the fundamentals of logic, rigour, abstraction, and the application of some bits of maths* be useful for everyone to know? Definitely. I strongly believe we'd have better nurses, plumbers, fighter pilots, street cleaners, and so on in the future if children learn how to make Tetris when they're in school now.
* There's so little actual maths in coding these days this is actually a really tenuous thing to say. I've been a developer for 15 years; for about 14 of those years I've been wrangling strings with all the maths neatly abstracted away for me. Thank goodness.