This is akin to the vendor lock-in aspect of serverless designs. You’re going to end up stuck in an ecosystem — which isn’t a priori a bad thing. It’s a tradeoff to be balanced against the benefits you gain in simplified development and ops.
Part of the answer may be that as more of the underlying framework logic (e.g., URL path routing) gets moved into infrastructure (e.g., API Gateway), the actual code being deployed can be increasingly specific to the domain of the application, which tends to be core IP and thus less likely to be shared anyway. Maybe what gets shared is architecture diagrams, rather than CloudFormation templates or Terraform configurations.
The other answer may be that the level of code sharing goes down, and the number of SaaS providers explodes. Algorithmia is a company looking to make serverless microservices monetizable. I think this path has a lot of obstacles once you get down into the weeds of SLAs, API stability, security audits, etc. But, it’s still a possibility.