He did not have to issue an injuction. All he had to do was allow discovery and refer it to Congress for action or inaction.
The puprose of discovery is to help decide a court case, not give something to pass along to Congress. You are really asking for a fairly activist role of a Judge if you want him to order discovery on an issue he can’t by law decide.
Courts have no power to order discovery unless it is in aid of a pending lawsuit which is within the court's jurisdiction. Courts can't order discovery for the use of Congress. Congress has its own subpoena power if it wants to use it.
A plaintiff can’t file a lawsuit simply to obtain discovery - a plaintiff must seek some sort of relief (whether it is monetary or injunctive). In this case, the Plaintiffs sought an injunction, which the judge (rightly) concluded he did not have the power to grant. A court may not hear a lawsuit if it is not within the judge’s power to grant the relief sought by the plaintiff. If the court cannot hear the lawsuit, discovery cannot proceed.
It is not the role of the judicial system to “allow discovery and refer [matters] to Congress for action or inaction.”
Exactly how does that work?