Nonlinear large deviation bounds with applications to traces of Wigner matrices and cycles counts in Erd\"os-Renyi graphs