While the policy is abhorrent, cruel, and destructive to the nation, I think the court got it right on the law. Essentially, one administration should be able to change discretionary policy that a previous administration made. This ruling will be important in 2025. Also, I agree with Kavanaugh in his consent opinion:
One final note: The larger policy story behind this case is the multi-decade inability of the political branches to provide DHS with sufficient facilities to detain noncitizens who seek to enter the United States pending their immigration proceedings. But this Court has authority to address only the legal issues before us. We do not have authority to end the legislative stalemate or to resolve the underlying policy problems