With existential wildcard types, we can write a function like this, which will work as desired:
def apply[Env](
serverEndpoints: List[ServerEndpoint[_, _, _, AkkaStreams & WebSockets, Future]],
layer: ULayer[Env],
serverOptions: Option[AkkaHttpServerOptions],
): Route = serverOptions
.fold(ifEmpty = AkkaHttpServerInterpreter())(serverOptions => AkkaHttpServerInterpreter(serverOptions))
.toRoute(serverEndpoints)