gh-37316: use CommutativeRing in ring_extension
Removing one of the last uses of `CommutativeAlgebra` class, towards its
deprecation.
Also a few pep8 fixes in the modified file.
### :memo: Checklist
- [x] The title is concise, informative, and self-explanatory.
- [x] The description explains in detail what this PR is about.
URL: https://github.com/sagemath/sage/pull/37316
Reported by: Frédéric Chapoton
Reviewer(s): Martin Rubey