Fix exception when compound matching grains

Inject the grains dictionary into __opts__ before proceeding. Refs #7944.