There are many costs and risks which offset the benefits of functional specialization.
As Adam Smith noted, the benefits are limited by the extent of the market. At any point in time, there are only so many customers for a given product or service.
Functional specialization and trade are limited by transaction costs. In an earlier age, vertical and horizontal integration strategies were effectively pursued because transaction costs were high. Specialized internal or external providers require investments in communications, marketing, contracting, evaluation, incentives, training, negotiations, influence, hand-offs, shipping and receiving.
Alignment of interests requires meetings, contracts, communications, incentives, negotiations, penalties and time.
Functional specialization is limited by transportation, finance and communications costs across country, state, firm and departmental borders.
Outsourced functional specialization also incurs the added costs of marketing and supplier management.
In general, firms have developed effective strategies to overcome these limitations.