I wouldn’t, Routes are an explicit part of your Service Contract which serves as explicit public documentation for what’s required to call Services that I wouldn’t be trying to hide/DRY behind magic configuration that intentionally changes the meaning for each route, unknowingly to anyone relying on the call-site routing declaration - leading to an unnecessary source of confusion.
We don’t maintain Swagger UI, it may not like wildcard path prefixes, can you provide a sample of the json from the /openapi endpoint and a screenshot or a description of the issue. Is the issue only when overriding GetRouteAttributes() or for all Routes with wildcard prefixes? e.g. [Route("/{environment}/records")].