To find out stuff like this quickly, Odoo has a "trick": if you click in the upper right on your username and "About Odoo", you can click "Activate Developer Mode". Now, when you go to the view of a product, click "Edit", and hover over a field label, it will show information about the field.
In this case, hovering over "Routes" tells us that this is a "many2many" field called "route_ids", bringing the object "product.product" in relation with "stock_location_route".
Usually the corresponding database table would be called something like "stock_location_route_product_rel", but in this case we are not that lucky. However the Odoo source code (addons/stock/product.py) gives us the definition of this relation:
'route_ids': fields.many2many('stock.location.route', 'stock_route_product', 'product_id', 'route_id', 'Routes', domain="[('product_selectable', '=', True)]",
help="Depending on the modules installed, this will allow you to define the route of the product: whether it will be bought, manufactured, MTO/MTS,..."),
Which tells us that the table name is "stock_route_product".
The following query will give you the checkboxes set on a certain subset of products,
select pt.name, slr.name
from stock_route_product srp
inner join product_template pt on srp.product_id = pt.id
inner join stock_location_route slr on srp.route_id = slr.id
where pt.name like '%keyword%'
and slr.name in ('Make To Order', 'Buy');
Or for all products,
select pt.name, slr.name
from stock_route_product srp
inner join product_template pt on srp.product_id = pt.id
inner join stock_location_route slr on srp.route_id = slr.id
where slr.name in ('Make To Order', 'Buy');
Actually, following query is even more insightful, here you will see the missing checks displayed as NULL,
select pt_id, slr_id, srp.route_id, srp.product_id
from (
select pt.id as pt_id, slr.id as slr_id
from stock_location_route slr, product_template pt
where slr.name in ('Make To Order', 'Buy')
) q
left join stock_route_product srp
on srp.route_id = q.slr_id
and srp.product_id = q.pt_id
Now then this is the list of missing records you need to insert in stock_route_product (using INSERT or import/export):
select pt_id, slr_id
from (
select pt.id as pt_id, slr.id as slr_id
from stock_location_route slr, product_template pt
where slr.name in ('Make To Order', 'Buy')
) q
left join stock_route_product srp
on srp.route_id = q.slr_id
and srp.product_id = q.pt_id
where srp.route_id is null