The court decides whether a subpoena should be upheld or not. If the judge has signed off on this one, then it's all legit. Failing to comply would be contempt of court.
As it gets more and more weaponized the slow arm of the law will move to prevent it.
The legal cost aspect is unfortunate. However, as others have mentioned, the court probably doesn't require the assembly of new documents, but rather submission of existing ones. So while there is a cost, it's not devastating.
The interesting question is whether or not this specific subpoena has real merit, or if the court was played by Meta.