Control external motor + 3d printer

I have a project idea, and I'm wondering if octoprint would be a good way to implement it.

I have a monoprice select mini printer that I want to try to re purpose to make mini punch needle rugs.
(would be a similar process as turning a 3d printer into a plotter and I'd generate custom gcode based on a design)

My main issue is that the punch needle needs to be rotated as you go. Would it be possible to create an octoprint plugin to control an extra motor with the pi alongside the 3d printer to turn the needle at specific times? Or is there a better way to go about this. Thanks!

First I would check if the printer is/or can run Marlin firmware. I would see about modifying Marlin to use an auxiliary axis for either servo or stepper for rotation (it can do either but the application dictates best use).

Thank you for the advice! It should be compatible with Marlin firmware. I wonder if I could even take the extruder apart and repurpose its motor instead of adding a new one, since I doubt I will be printing with this printer anymore.