First-Order Conditions for the Optimal Control of Learning-Informed Nonsmooth PDEs