[SPARK-3198] [SQL] Generate the expression id when necessary

Marking this as transient and lazy means that this could change on the slaves which is a little weird.  Honestly I think the correct change here is to get rid of this id entirely and change usages of it to do reference equality instead (`eq`).