The extension enable debugging in your browser (a banner appears telling you about automation). It's possible to detect that in JavaScript.
Hence why projects like this exist: https://github.com/Kaliiiiiiiiii-Vinyzu/patchright. They hide the debugging part from JavaScript.