Add optional before/after filter callbacks

These allow nodes that manage inventory in a non-standard manner (e.g. a
barrel) to still be able to work with pipeworks filters.