Fix bug that prevented writing optional Avro records, arrays or maps

The writeValue method in AvroWriteSupport would correctly resolve
the non-null type but would incorrectly try to write records,
arrays and maps with the original union schema triggering e.g.
AvroRuntimeException: Not an array: ["null",{"type":"array","items":"int"}]