This is a verified bug that hasn't been fixed
https://bugs.mysql.com/bug.php?id=108582
quoting here:
[23 Sep 2022 12:43] MySQL Verification Team
Hi Mr. Power Gamer, It turns out that you are correct. You can no longer use ANSI option for mysqldump, due to this bug. This is due to the reason that ANSI option enforces ONLY_FULL_GROUP_BY. We do not know whether that particular query will be changed in mysqldump, or that ANSI mode will be disabled. This, however, has nothing to do with the fact that you are correct regarding the ANSI option. This report is now a verified bug.