All software should, by spec afaik, prioritise IPv6 over IPv4.
Therefore if there's an AAAA record tools and libs don't automatically fall back to A records upon failure to connect. Otherwise tons of superfluous requests would be made (happy eyeballs algo works that way).
(Web browsers, being the horrific standards bending and user-pleasing beasts they've always been, use the "happy eyeballs" algorithm that breaks all the migration motivation and introduces confusion which makes the desktop experience "better" than say using libraries and other development tools).

The solution is to make the AAAA record work (either the local host does not have proper IPv6 or the remote host has an error, or any routing in between). Don't disable IPv6 .(