Shameless ContentHandler plug: settings could be stored as structured data (JSON blobs) on wiki pages, using specialized handlers for rendering and editing, similar to how Wikidata does it. Caching would be applied as before.
Config pages would live in a separate namespace, and extensions could have their own pages there (and may perhaps even supply their own UI for complex settings).
Advantages:
- no storage layer code to write.
- versioning/diffing and logging just work.
- revert/undo just work.
- import/export just work.
- permission system (on the per page level) just works.
Disadvanatges:
- can't really hide settings. Read permissions could be set per page, but might still be exposed in dumps, etc.
- accessing config pages from another wiki may not be trivial.