Three-body effective potential in general relativity at second post-Minkowskian order and resulting post-Newtonian contributions