You gotta remember that John Roberts' theory of jurisprudence is that the Court should always defer to the Beltway consensus in order to maintain legtimacy. The problem here is the Beltway consensus is that immigration law shouldn't exist and Donald Trump isn't a valid President, and deferring to that consensus is so transparently bonkers and would result in such insanely bad precedent that he can't bring himself to rule this way. Consequently, when deferring to the Beltway means doing something batshit crazy, he chooses to punt. We saw the same thing in 2020. Hearing the lawsuits ran the risk of exposing criminal behavior on the part of the Democrats and flipping the win to Trump, an intolerable result, but "haha yeah lol breaking election law is fine who cares lmao" also isn't something Roberts is comfortable with ruling, so the only option left was to find reasons to not hear the cases at all.