A customer project built on an FLOSS platform or framework (a CMS like Drupal for instance) may require some fixes to the underlying platform if it is pushing the limits or is being delivered on a very new version of the platform. For projects which use or integrate multiple FLOSS platforms/frameworks/libraries there may be a number of fixes or small extension created that fall under different projects, potentially with different licenses.
If we assume that the code being built for the customer is separate from the platforms or frameworks (a custom Drupal module or theme for instance), then the customer would reasonably expect to own the rights to the code they have hired or subcontracted the delivery of.
Is there a standard form (ideally from a major foundation) for excluding any code contributed to FLOSS projects from the rights assignment to the customer up front?
EDIT: The aim of such a clause or template would be to protect the subcontractor or freelancer, not the employer or send user organisation. Rights to any code built during the contract which is part of the supporting ecosystem should remain with the freelancer or subcontractor to be contributed under their relationship with the relevant projects[s].
This would protect the freelancer or subcontractor from any claims that the customer's IP was given away when patches or extensions to ecosystem projects are contributed. If such an arrangement is in place at the start there won't be any complex or time consuming wrangling over individual contributions. If the process of contributing is simpler the customer will more likely be running on a standard rather than customised version of the ecosystem projects. Which would speed up development and ease maintenance and upgrades.