If the designer and producer of a product are two different companies, then who is responsible for the CE marking of the product. In other words, who signs the Declaration of Conformity?
The one who can review the design and fully customize it. That means in principle the main contractor.
However, it often happens that a company outsources aspect A to the company X and aspect B to company Y. In that case, the party who can customize so that is meets the requirements of the Directive should sign the Declaration of Conformity and affix the CE mark.
Even if you fulfill the role of main contractor, it does not mean that you are responsible for the CE mark. You must have the freedom to (re)design the product to meet the requirements.
If you think that measures are needed, but there is no money for it to be implemented, then you cannot affix a CE mark on the product. After all, the product does not meet the minimum safety requirements.
A Declaration of Conformity is signed by someone in the company who has drawing permission. It is a legal contract. The company declares that the product complies with the Directives applicable for that product.