Accidental?
He spoke out against it publicly and even threatened to veto should it make it through Congress.
It was him speaking out against it (and the abuses of it by intelligence agencies) that discouraged both Democrats and Republicans from pushing it through.
Trump didn't like the IAs and they didn't like him.