Joseph Wright’s English Dialect Dictionary (1898-1905) says that demic is an aphetic form of epidemic and comes from the potato disease (from Yorkshire, Nottingham, Lincoln dialects). I believe the meaning has extended from there to being sick (also in army slang) and then, to something broken/dysfunctional.
DEMIC, sb. and v. Yks. Not. Lin. Also written
demick m.Yks. w.Yks. Not.; demik w.Yks.; demmic
n.Lin.1; demmick e.Yks.1 w.Yks.; demmock w.Yks.;
demmuc n.Lin.1; demmuck sw.Lin.1; demock w.Yks.;
dimmock e.Yks.1 [de·mik, de·mək.]
sb. An
epidemic.
w.Yks. N. & Q. (1897) 8th S. xi. 176; w.Yks.3, n.Lin.1
The potato-disease.
e.Yks.1 w.Yks. (S.P.U.); Floods, robberies, cattle plague,
small pox, measles, t'demmick an' what not, Yksman Comic Ann.
(1877) 39. n.Lin.1
A whitlow or thecal abscess, suppuration.
w.Yks. I've demick i mi thumb, ECCLES Leeds Olm. (1879) 21;
(J.T.); (S.P.U.) n.Lin.1
Hence (1) Demicked, adj. gathered, diseased; (2)
Demicky, adj. suppurating.
(1) m.Yks. You've got a demicked finger (F.P.T.). w.Yks. Aar
Bill hez gat a demik't thumb, ECCLES Sngs. (1862) 141. (2) w.Yks.
ECCLES Leeds Olm. (1879) 21.
v. Of potatoes: to take the potato-disease.
e.Yks.1 Deeant let em stop onny langer ĭ grund or they'll all
demmick. n.Lin.1
Hence Demic'd, ppl. adj. diseased, suffering from the
potato-blight.
Yks. The seeds I bought back end of last year wur half of 'em
dead or demic'd, FETHERSTON T. Goorkrodger (1870) 32. w.Yks.
Those potatoes o' yours are all democked, gaffer (H.L.); Tha
munnot tak nooan nobbut demmocked ens, HARTLEY Clock Alm.
(1878) 38. Not.2 n.Lin.1 He's caaingin' awaay like a demmuck't
taatie. sw.Lin.1
[An aphetic form of liter. E. epidemic.]
https://eddonline-proj.uibk.ac.at/edd/index.jsp
Here is a reference I've found from the "Bulletin of the University of Leeds and the Yorkshire Council for Agricultural Education (Issues 36-70) - University of Leeds:

Here is the longer script I could extract:
(1) Potato Disease or “Demic,” Phytophthora infestans (De Bary). The obscurity in which the life history of this disease has been enveloped during the last half century has not, up to the present, been entirely removed.
It is generally believed, with more or less positive evidence, that Potato tubers can become infected with this fungus, while the crop is still growing in the field, in two ways .
Eric Partridge's A Dictionary of Slang and Unconventional English lists demmick also and provides the following:
A soldier on the sick list; an article become unservicable: Army: C.20. H. & P., 'The derivation is probably "epi-demic-ked"'; probably.
For the usage of demic in railway jargon, I've found two references that it might be derived from an old telegraph code used to indicate a failed train in the railway industry. The references are from safety.networkrail.co.uk and railforums.co.uk. I couldn't find any other evidence from publications or railway bulletins. Although, the "failed train" sense is related to the semantic extension of the word from sickness.