If the trackpad is moving by itself then it is likely that the trackpad has become loose and thus causing connectivity losses or shorts.
Disconnecting the trackpad may have also disconnected a shared connection between keyboard and trackpad. Or perhaps some other dependency with respect to the keyboard and trackpad,
Or during the trackpad disconnect something else was disconnected or damaged.
Likely difficult to fix.
Send for repairs. Hopefully there is some remaining warranty.
Caveat being that you did not do anything that voided warranty.