I am telling this as an engineer working in the Canada's oil and gas sector. Since 2014, salaries in our sector have decreased and firms are struggling. "Just raise the price of oil" is not an actionable advice. The price of oil is not ours to set. It's the market's
https://www.lowtechmagazine.com/2020/04/fruit-trenches-culti...
You're absolutely right that perhaps not everything should be grown everywhere, but I strongly believe that a country should have a local source of all the calories and vitamins / minerals they need. In Canada, for example, maybe they encourage farmers to grow greens, brocolli or potatoes instead of citrus for vitamin c, but they absolutely need a source.
But imported products don't fly right into the country. There is customs, and denying/tariffing them is a policy that countries are very actively using. So at the end of the day, it's a political decision.
Edit: On the other hand, if you are exporting stuff (oil for Canada), then you can't really do that for the external market. Might explain why the government will let some sectors run with illegals (to remain competitive); the alternative being their ultimate demise.
[0] https://en.wikipedia.org/wiki/Chicken_tax
[1] https://www.npr.org/sections/money/2017/01/25/511663527/epis...
Australia does not use this approach, and instead seems to have pushed other countries to eliminate their own tariffs for the TPP.
Of course, you might get pilloried for the artificial scarcity, but hey... nobody ever likes the capitalist :)