How could you do programmatically what Joomla does when you install a plugin? Let's say, for simplicity's sake, that you have a plugin package file local with your Joomla instance.
A solution might look like one of:
a) You make a POST request to a Joomla endpoint with the package file that installs the plugin.
b) You write a shell script that both installs the package file's contents in the correct folder, and writes the required data to the db (more brittle this way).