Yeah I have not found a way to fix my reputation, if someone does please reply. I have pretty much abandoned the village I worked on because of this. Hopefully this gets fixed.
I just spent about an hour in creative mode maxing out trades to try and fix this and am still getting attacked and negative rep.
Need to use a grindstone now.
Also to add to this I completed a raid with the village after this and still the bad reputation persisted.
Going into spectator mode was how I had to get out.
I am currently also experiencing this. Accidently hit a villager twice while they were in a boat and now the rep has spread and got so bad that Iron Golems are aggroing on me. I have tried making trades with villagers but the bad rep is spread too far.
The only way I have been able to stop this is switch the game to peaceful and despawn all Pigmen then go back to the previous difficulty.
I have had random Iron Golems aggro on me. I hit a villager but that was many trades ago. Not all Golems aggro either it seems to be random ones and they sometimes deaggro.
Just cured two zombie villagers and introduced them into the village hope this helps fix the reputation.