Great example. Leetcode absolutely does not test for this. Frankly, no FANG interview question I have ever personally seen tests for this. This sort of deep experience comes out when you actually talk to a candidate about their technical work, what was a really subtle bug you tracked down, etc.
Its really hard to test for that as part of an interview question. FANG is able to resolve that by hiring lots of people that pass a sufficiently high bar and then figuring it out as they go... and even when the people don't have the appropriate problem solving skills, there's likely still work for them to do.
Smaller shops that don't have the luxury of hiring many developers may find that only 5-10% of their devs have the necessary problem solving skills... and that's a hard pill to swallow.
Those skills can be cultivated. Some get there through shear grit, but it takes time. But this is where jumping from one job to another gets problematic - it takes time. If someone is switching jobs each year its harder to know if they've gotten to the point where they can solve problems.