If the browser can do it what's stoping a headless browser bot from evaluating it all the same? Is it just to lower the attack surface?
The vast majority of crawlers aren't that smart, headless browsers used to be painfully slow so no one used them.
In fact doing so probably violates the halting problem somehow.