[SPARK-3969][SQL] Optimizer should have a super class as an interface.

Some developers want to replace `Optimizer` to fit their projects but can't do so because currently `Optimizer` is an `object`.
I think `DefaultOptimizer` or `BasicOptimizer` may be better names. Conceptually, Catalyst is not tightly coupled with Spark (I know right now Catalyst depends on Spark code somehow, but we don't want to exacerbate this trend).