Well, this isn't that bad on a real database which will know to decorrelate[1] the subquery but a GPT based AI probably won't advise you to do an EXPLAIN and check the plan.
1- e.g as Jamie explains here https://www.scattered-thoughts.net/writing/materialize-decor...