I have a simmilar issue on Repo sync fails after a first app restart on new installation of Foreman 2.4 / Katello 4.0
As it was a fleshly installation too, i’m testing " [Fixes #32475 - clean_backend_objects still uses Pulp 2]" + “foreman-installer --reset-data” solution.
For the momment, that fix for me.
Regards.