Hum sounds like a ground issue. The guitar has to be grounded to earth. If you just use a battery powered pedal, the shield of the cable connected to the power amp becomes earth. If the input of the power amp is balanced, you cannot connect the shield to the negative input because then it won't be earth grounded and you'll definitely get hum. The only option then would be to connect the shield to the negative input and also to the shield connection of the balanced in. Then the guitar ground is the power amp ground. That should work, that's what guitar amps do, but if the power amp is not designed for it, the ground wiring in the power amp might not be optimal for giving the guitar a straight shot to earth ground.
One option for direct guitar to line is get a high Z input DI with impedance balanced or fully balanced (but preferably ground sensing or better a transformer) output but a two conductor cable like XLR or TRS so that the shield is only used as a shield and you get the benefits of a balanced (or at least impedance balanced) signal.
The other option would be to just manually connect the ground of the guitar to earth ground somewhere and not rely on the power amp. It's a bit of a hack but technically it's probably the best performing option. Meaning use a device that has an earth ground power supply and a high Z input.
You could probably test if the hum is related to grounding by running a piece of wire from the earth ground of a mains socket (careful!) to the shield of the downstream end of the guitar cable. Just touching it to the nut of the input jack might be enough to hear a change in hum. That would be strong evidence that the ground of the power amp is not ideal for grounding your guitar.
And of course whatever you're doing, everything has to be shielded. If you're playing around with open bits like just a die cast aluminum box with the lid off, EMI will get into your high impedance guitar signal and induce hum.