Perhaps you need to provide more detail about your system and what is happening.
My computer: Macbook Pro 13 inch Late 2011 with MacOS Sierra 10.12.6
My MIDI keyboard: AKAI APC Key 25
My LMMS: LMMS 1.2.0 rc7
Instrument/plugin and preset used: ZynAddSubFX with DX Rhodes 3 preset (most likely this part makes no difference).
MIDI settings: select APC Key 25 as MIDI input / plus map VOL to first control knob on the device
Test audio and then disconnect the USB to the MIDI keyboard
Wait 10-20 seconds and then reconnect.
The keyboard is still mapped to MIDI and the audio volume can be controlled by the first control knob on the keyboard. No need to restart LMMS.
The only thing that is "lost" is that the keyboard forgets if I previously selected the Octave-Up or Octave-Down switch and that is because the keyboard is USB powered.
Edit: I tried repeating this with LMMS 1.1.3 on a Debian 9.6 Linux amd64 desktop pc with Z77 chipset and ALSA sound (all other LMMS parameters the same as before) and I also lost the MIDI connection after reconnecting the cable.
However, just like with macOS, there is no need to restart LMMS in debian linux, just reconnect the MIDI channel in the instrument settings or restore instrument settings (including MIDI) from a preset.
Some suggestions, upgrade to LMMS 1.2.0 rc (latest) and try different USB ports, e.g. USB2 vs USB3.