A J-box cannot be left unattached. It would need to be secured to the structure. However, there is a bigger problem: virtually none of those flat LED fixtures are UL listed, which is required by the NEC for luminaires. This is now an archaic rule which should be abolished, but it's still on the books. The original purpose was to ensure that incandescent fixtures didn't pose a fire hazard. Light bulbs get very hot in normal use, so they require more careful fixture design than many other kinds of electrical devices. Most other types of electrical equipment are not required to be listed unless the local jurisdiction mandates it, but luminaires all must be listed. Since LEDs do not pose the kind of special fire hazard that incandescent lights do (and are less hazardous than plenty of other kinds of electrical devices) it no longer makes any sense to have this special rule. But it's there. So you can only use these imported unlisted fixtures if the inspector doesn't enforce that provision or there is a local amendment that allows it.
Because these fixtures are generally not legal for installation at all, the manufacturers don't seem to concerned about making it easy to comply with the other code provisions if you do install them. The detached driver module poses a problem, as you discovered. You need a decent sized box to put it in and the box must remain accessible (through the hole the fixture is mounted in is fine).