sub-expressions not wrapped by parentheses
Thanks for reporting. This bug was caused by modifying an internal flag on the expression node without copying it first. This caused subsequent usages of that expression node to carry-over the flag when they shouldn't have.
I have the following query (simplified for opening issue):

```python
expr = (Value(1) + Model.column)
squared = (expr * expr)
Model.select(fn.sum(expr), fn.avg(squared)).objects()
```

peewee generates the SQL query below

```sql
SELECT sum(1 + "t1"."column"), avg(1 + "t1"."column" * 1 + "t1"."column") FROM "model" AS "t1"
```

Notably, the sub-expressions in `avg(1 + "t1"."column" * 1 + "t1"."column")` are not wrapped by parentheses as expected. That is

```sql
SELECT sum(1 + "t1"."column"), avg((1 + "t1"."column") * (1 + "t1"."column")) FROM "model" AS "t1"
```