Pelé was ensnared by ‘Brazilian-style racism’ but stood firm as dictatorship tried to keep him playing