Let's not leave all the blame with the officials here. Yes, the 4O appears to have made a serious mistake. But why didn't the coaches immediately say something when the sign went up. Why didn't the sub go in call the guy who was supposed to come out? And why didn't the staff notice when the player who was supposed to be coming out didn't?
I do think it is an interesting scenario. If play had not re-started, I think we could fairly take the position that the substitution has been completed (i.e., the sub is now a player), but still ensure the player who was actually supposed to come off leaves rather than Neymar being excluded because the 4O held up the wrong number. (If Neymar had actually exited the field as part of the sub process, I think that would make it harder to justify.)