nestedContainer in KeyedEncodingContainer and UnkeyedEncodingContainer should be throwing

Could potentially, yes — but are there common formats which do, and in a way which necessarily require throwing on a container request?

Note that it is not our intent to be able to represent all possible serialization formats and their limitations. From another thread:

It's possible to come up with formats which put such strong limitations on encoding, but I'm not sure how well they would fit the Codable model otherwise.

Indeed, the representation of Array cannot change, but that is to our benefit because we can rely on it not doing anything special. If you wish to allow Array and Dictionary to encode empty containers (while other containers become no-ops): both of those cases fall into encode<T : Encodable>(_: T...), wherein you can check whether the object is an empty array or dictionary and store [:] or [] directly instead of asking them to encode.