This thing is a disaster at so many levels. First let's tackle the instant (immediate) case.
The fundamental rules being broken here are that: every hot must travel in the same cable with its partner neutral, hots cannot use neutrals from different circuits, and hot, neutral and ground must be sourced from the same (sub)panel. **
There are two radically different approaches to fixing this, assuming the main panel is full. Both of them involve a favorite trick of mine: putting a large steel junction box smewhere appropriate (usually quite near near the panel, with a <2' short run of EMT conduit into the panel). Site the junction box so all the cables can make it with their existing length.
Approach 1, pull the 2 circuits in question out of the main panel, and terminate them in this junction box. Then, double back from the subpanel with two runs of /2 Romex of appropriate AWG, bringing that also to the junction box. Splice their hot-neutral-ground all separate, except for grounds which can be a big clump with a ground pigtail from the junction box. The junction box is now the subpanel's grounding system, but it doesn't matter if the EMT also provides a grounding path, since you also grounded the subpanel.**
approach 2: find two other circuits or one 240V circuit now landed in the main panel, which lend themselves to be easily rerouted to the subpanel. Again you can use an intermediate junction box, but the box must remain accessible. Now, with two breaker spots freed in the main panel, move your two problem circuits back to the main panel.
On the subpanel, you see that Romex flopping around wingle-wangly. Nope. Staple that stuff properly, find a way to use any extra length or shorten it in the panel**, and if its already too short, either put some lumber there for it to run along, or junction box/splice/extension.
**Related, your subpanel does not have a ground nor ground-neutral separation, but that's a pretty easy fix. Buy and install two ground bars that are correct for that panel (get these at a REAL electrical supply house which sells that panel type, GE Q line?) one at the top, one at the bottom, so all the ground wires will reach. Move 'em to the ground bars. Remove any neutral-ground bonding straps or green screws on the neutral rail. Then, get some probably #4 bare ground wire and run it from the main panel to the sub. It is legal to retrofit grounds in this way. There may be a way to weasel out of this using Code grandfathering, but it's easy and cheap to do it, using the routing the blacks are now using. The dusty old neutral bar and shiny new ground bar will impress the inspector.