I do like the idea of nesting functions.
This is basically the step-down of Uncle bob, which I referred to before.
It will be a bit of a pain, but did you look at optin requirements?
https://kotlinlang.org/docs/reference/opt-in-requirements.html
You can use it a bit to flatten the classes.
This however isn’t as well enforced as your current syntax