I remember very clearly my brother saying, "be nice!" to his toddler son years ago. He was playing with my toddler sons, and I haven't a clue what triggered the exhortation. I think about being nice a lot. The trick is figuring out when to be nice, and when you really should not be nice.
Do you question that there are those times?
As a parent, there are many times when you need to be kind, but firm. There is a kindness to nice for sure, but nice also implies pleasantness and friendliness. A screaming, kicking toddler isn't pleasant or friendly, and the firmness required will not be perceived as pleasant nor friendly to the little darling.
The adult world also has many situations which make being nice untenable. Outrage, indignation, and forceful objections to injustice are often appropriate, and almost never nice. Abuses of power, deceptions, and foul play cannot be addressed nicely.
Nastiness and sarcasm don't usually help when you encounter unniceness. But speaking rationally, politely, and to the point, which is usually helpful, does not always make it pleasant enough to be called nice.