I was taught that.
The person who taught me that always felt put upon and unable to set boundaries with people. She never said “No,” and some people always took advantage of that. In their faces she was all smiles and “No problem!”, but behind their backs she would bitterly complain and tell me not to be nice to people, or else they’ll take advantage of you. OTOH, she expected everyone she asked a favour of to give in right away and was surprised when she got pushback from violating people’s boundaries.
Oy. It took me a long time to recognize that I didn’t have to expect everyone else in the world to be like her or the people who took advantage of her (there were a lot!), and that I could be kind, yet set boundaries and that was all OK.