Lots of comments about "not to code". AFAIK, the IRC only pertains to the building wiring, not to what you plug into it. What code provision does this violate?
I can think of lots of reasons it's a bad idea if you don't know what you're doing and aren't pretty careful about how you do it, but it doesn't seem like "code" is one of them. If you're willing to go to this much trouble it would seem that just pulling a proper new circuit to the garage for an outlet or charger wouldn't be that much more effort.
A quick google re actual code violations brings up this thread:
Combining two 110v/12A circuits?
TLDR: seems to be a code violation.
"The NEC does indeed cover temporary electrical installations. Article 590. 590.2(A), "Other Articles", says "Except as specifically modified in this article, all other requirements of this Code for permanent wiring shall apply to temporary wiring installations." That includes most of articles 250 (grounding), 300 (wiring methods), and 625 (electric vehicle charging).
The Quick220 suffers from several deficiencies. The primary violation is 300.2(B), stating all conductors of the same circuit and equipment grounding conductors shall be contained within the same raceway, cable, or cord, from the panel. However, there are numerous violations of grounding code because of multiple EGC's from separate circuits; lack of common-trip for all ungrounded conductors; among others.
When two grounding conductors are used, the failure of a neutral in a feeder -- say to a campground pedestal, which is more common than you might think -- can create a situation where return current will flow through the grounds on the Quick220 device, or in some cases, leave exposed parts of the device at 120V to ground.
It's a bad idea, period. Do it right the first time so people don't get killed."