Is it within code to hang a pendant light independent of a junction box?
Only if the fixture has its own built in junction box. This is not common on most fixtures that are surface mounted, except for flat fluorescent fixtures or under counter fixtures. You do often find it in recessed fixtures, like can lights.

Fixtures that have built in boxes have a small entry hole for the cable and a clamping mechanism. If a fixture is rated to take a cable directly, rather than being mounted to an approved junction box, its installation instructions will make that clear.

If it is not rated for direct cable mount, the connection you propose will be against code, and more importantly, unsafe.

Finally, if it is code rated, you still have to leave the existing box accessible and need a blank cover over it.