5000 queries is really not much, at least not when executed sequentially.
For context, in DNS (server) sizing discussions, we'd usually talk about how many queries per second or maybe queries per month. We might also worry about amplification effects depending on the type of query & type of server.
Here's what an old F5 whitepaper suggests is robust DNS handling in 2018:
With DNS Express, the individual core of each BIG-IP device can answer approximately 125,000 to 200,000 requests per second, scaling up to more than 50 million query RPS, greater than 12 times the capacity of a typical primary DNS server.
(source: https://www.f5.com/services/resources/white-papers/the-f5-intelligent-dns-scale-reference-architecture)
So you can see 5000 queries isn't very much. But it might create extra load if executed in parallel or often, or if your network's DNS server is undersized or overloaded. You don't specify frequency, but this doesn't sound like a task you would run frequently.
It still might be polite to space those queries out regardless, but if you're actually calling dig
5000 times in a row from a script (and waiting for an exit value) that builds in a slight delay between each query anyway. Also a longer delay for domains that can't be resolved, and a much longer delay for those whose nameservers are nonresponsive.
But if you were running this script frequently, you'd be repeating the same queries often. In that case it's better to do some local caching to reduce that repetition, but implementation details are outside the scope of this question.
I don't think your ISP will care unless the network has a very Low bandwidth uplink or an extremely limited stateful firewall (ie, maybe check with them if you're at a facility in Antarctica).
Consumer ISPs also care more about inbound queries, not outbound (ie, are you running a prohibited server).
tl;dr 5000 MX lookups won't raise any red flags unless you have a very undersized DNS server, tiny uplink, or maybe run them in parallel.
It's a small number in the scheme of things.