Note that I had to make some guesses about the rest of your config. In your previous code snippet you were referring to count.index despite no longer having a count configured on your resource … I’m surprised that didn’t cause an error.
The requirement for for_each is to provide a mapping that has one element for each instance you want to declare. You can therefore declare no instances by providing an empty mapping.
In your case you seem to have what is effectively a list of objects which each contain a set of ids. The top-level list is created automatically by Terraform to handle the dynamic number of data.aws_route_tables.private_foo indices (zero or one, in your case) and the nested set is part of the implementation of the aws_route_tables data source.
I think that makes this a good candidate for Flattening nested structures for for_each in the flatten function’s documentation, although this particular application of it can be simplified a bit compared to the more complex example in the documentation:
data.aws_route_tables.private_foo[*].ids returns a list of all of the values of ids across all elements of data.aws_route_tables.private_foo. Because ids is a set(string) value, the result here is a list of sets of strings.
flatten(...) turns that list of sets of strings into a flat list of strings, by eliminating the intermediate sets.
The wrapping toset(...) turns that list of strings back into a set of strings in order to meet the requirements of for_each.
You will therefore end up declaring one instance of aws_route for each distinct route table, which I think is what you intended to do here.