“So Congress can pass a bill and forbid the court to rule on its constitutionality.”
That didn’t work with Gitmo.
There was no bill forbidding the court to rule on GITMO. If there was then they could be impeached. For that matter the bill could include criminal penalties for the court if they violate it. They’ve never used it, but the power is right there in Article III. The Constitution intended Congress to have the ultimate power, not the courts.