Phonon-mediated superconductivity in strongly correlated electron systems: A Luttinger–Ward functional approach