I found an off-the-shelf PWM-to-0-5V converter module, but the signal coming from the printer mainboard had to be inverted and isolated from the module. Not doing so caused too much interference. Luckily I happend to have some isolators and logic gates alongside with the needed passive components. Once the circuit's function was confirmed on a breadboard, I went on and designed a two-sided PCB on KiCad which then was processed on Flatcam and finally milled on our CNC.
For such quick prototypes and small volumes, it is hardly worth the expenses to order PCB's from the factory. It is very quick to make PCB iterations without the shipment delay.