Ticket/21975 monkeying around

Don't monkey patch Object#instance_variables. Move the switch into zaml, which was the only place the behavior was needed.