Using one backend with hundreds of servers from DNS SRV records


We’ve a few hundreds (sometimes 2000) servers each running the same service and we’d like to forward incoming request to a given backend server. Suppose in DNS we’ve:
registered for all service and the DNS is (almost) always uptodate.

From the frontend the request comes as:
https://<frontend>/someservice/<uuid>/<remaining path>/
From the <uuid> we can easily calculate the right server ip, but to be easier for the example let the <uuid> be the ip address of the right backend server.

In the backend config we’d like to write:

default-server check resolvers mydns init-addr last,libc,none
server-template someservice  1000 _someservice._tcp.public.internal

now we can choose the right backend server with a lua script.

But as the number of backend server grows the dns query for SRV records become larger and larger. Even for 118 server:
accepted_payload_size 8192
was not enough and we have to rise it to:
accepted_payload_size 16384
and at the same time switch to tcp for dns query.

Is there any better way to solve this problem?
How can we bypass the dns query size limitation?

Thanks in advance.