[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`.
Thank you for your suggestion.
I agree that Catalyst should not tightly coupled with Spark.