Fix deriving Encodable trait for unit structs

Closes #14021