A charity must only allocate its resources in pursuance of its charitable objects. Providing a "bankrupcty shield" to a donor is not capable of being a charitable purpose nor does it meet the public benefit requirement pursuant to sections 1 and 2 of the Charities Act 2011.
Bill Gates as a trustee
While a charity can pay a salary to its employees, it cannot usually pay its trustees a salary, and its trustees must avoid conflicts of interest. Where a trustee is related to an employee, there is a clear conflict of interest if that trustee takes part in any decision making process which sets the employee's salary. The standard procedure is that any conflicted trustees should sit out of such decisions. If the charity pays a salary far in excess of the market rate for the role, the trustees will open themselves up to being sued by the Attorney General (representing the public / beneficiary) for misallocation of charitable funds.
Bill Gates cannot therefore lawfully use his position as trustee of a charity in E&W to ensure that money which he donated is received by his family members via artificially inflated salaries.
Bill Gates as a donor
If a charity intends to claim Gift Aid on donations then the donation must be non-refundable, pursuant to sections 414(1), 416(1), and 416(3) of the Income Tax Act 2007.
In any case, a donor will have no power to compel a charity to return a donation unless the parties entered into a contract to that effect. If no such contract is in effect, then any money Bill Gates has given to the charity is unrecoverable and must be used to further the charity's objects. If such a contract exists, then the adminstrators of Bill Gates' bankruptcy will be able to recover the funds under the contract and use it to pay his creditors, so such an arrangement is useless.
Insolvency Act 1986
Under Sections 339 and 441 of the Insolvency Act 1986, the courts can make an order to reverse any transactions at an undervalue (including a gift) which have taken place in the 5 years prior to a bankrupcty (in the case of insolvency) or in the 2 years prior (regardless of insolvency). There is a rebuttable presumption of insolvency under the 5 year rule in cases where the transaction involved an associate of the person. See section 435 for the definition of "associate" which can include relatives, beneficiaries of a trust, and [charitable] companies.
This serves to prevent individuals from taking deliberate steps to distribute their assets in advance of a predicted bankruptcy.
If the Gates' estate is insolvent does the charity still function?
Pursuant to section 34(1) of the Charities Act 2011, a charity will continue to function so long as it remains charitable and hasn't ceased to exist or operate.
A charity could cease to exist if the underlying structure no longer exists. In the case of a charitable trust this could happen if all the trustees die without replacement or in the case of a charitable company if it is struck off the register (e.g. if all the directors die and are not replaced).
It is unlikely that Bill Gates' estate being insolvent will cause the charity to cease to exist or operate as it will almost certainly have or acquire independent trustees / directors to keep it operating.