Allow passing a block to factory methods

This updates the factory `instance` and `instance_stack` methods
to allow passing a block. It's a common pattern with factories to
`tap` the result. This provides the same functionality without
having to manually to the `tap` call. If no block is provided,
the method behaves as it previously did.