Data-Driven Influence Functions for Optimization-Based Causal Inference