A CNC traffic light for a hobby milling machine is surely only a luxury, but it simply makes fun, and that is already the most important reason to build something like this.
Suitable warning lights are available at Aliexpress under the name: “warning light industies CNC machine” and similar search terms. Depending on the version it costs (as of 2022) between 10 and 20, - €.