They weren't in the right state of mind. They were manipulated into doing so by Naruto.Nagato sacrificed himself and Obito did the same, there's a difference between this and suicide. Try a dictionary.
Naruto manipulated them? His TNJ isn't like that the one who does that type of thing is Obito who manipulated many ninja.They weren't in the right state of mind. They were manipulated into doing so by Naruto.