Fix for class eval optimizations in 3.6.1+

In 3.6.1+ a class evaluation optimization was introduced that prevents
the `services_array_defined` class from being re-evaluated several times
in a loop, so the `regextract()` is only evaluated for the first service
defined. To fix this, we define per-service classes, and define
`services_array_defined` using `classmatch()` on those.