I think you're missing the point. Encroachment should be eliminated so if a player encroaches and scores a rebound then the goal shouldn't stand and a free kick given to the offending team. Players knowing that would therefore not encroach as there is no advantage to be gained. However, as it...
Personally think the ref decision is what should be the correct one. Player encroached and took an advantage illegally therefore his team should be penalised and not given a second chance of scoring.