Being a custodian does not give you control of an asset unless it was set up specifically as a trust. The custodian is responsible for protecting the asset but beyond that cannot do anything it wants with it. A bank can't just clean out your safe deposit box or bank account if they want to. The owner gets to make those decisions (though the custodian may be asked to make any such actions). The Fed is custodian, not trustee, of the Treasury's gold.
https://www.sapling.com/7758362/difference-between-trustee-custodian
Share a link to the legal agreement that the Fed is solely custodian and not trustee? That is the $200 billion question, after all.
And yes, if the contract entered into with a bank says the bank can do whatever it wants with the box contents then it can, indeed, do whatever it wants with it or whatever is instructed to do by other entities. If there is no ownership conferred then how can a bank seize the contents of a box for various reasons? It wouldn't have legal authority to do so and would be required to not honor any such demands by, say, a tax collector or the whims of the legislature.