Should the cable be able to come out of the adjuster like this?
No, definitely not. It's a dangerous situation as the brake lever now cannot pull the cable inside the housing - the housing will just be pulled back with the cable and teh brake will not be engaged.
Either the cable is much too loose which has allowed the housing to slide along it, or the housing has come out of a stop on the fork (or the frame for a rear brake). Check the run of the cable and make sure it is inserted into any stops or the brake caliper itself properly.
Mechanical disc brakes can be tricky to adjust if you are used to rim brakes. The barrel adjusters are not used to adjust the position of the pads, adjustments must be made on the caliper to do that. Using the barrel adjusters can lead to a dangerous situation.
This Park Tool video shows how to properly set up and align mechanical calipers. The cable set up starts at about 3:39.