Biblically speaking, boundaries are related to self-control. The Bible commands us to control ourselves, whereas our human nature desires to control others (Titus 2:12). If left unchecked, our natural desires run roughshod over others. Personal boundaries help to limit our selfish inclination to control or manipulate others. Likewise, boundaries protect us from those who have no self-control and who wish to control us.
A person with clear, healthy boundaries communicates to others what is and is not permissible, saying, in effect, 'This is my jurisdiction, and you have no right to interfere.'
Someone with healthy boundaries takes responsibility for their own life and allows others to live theirs. The goal of boundaries is to make sacrifices for people when appropriate, but never in a destructive manner. We should be available for people in a crisis, but unavailable to indulgent demands. Being gracious is not a blank check for others to continually drain our emotional account.
Jesus was known for setting boundaries. He would regularly take time away from people, even when they were looking for him, to go and be alone with the Father. If he felt the need to live into everyone's expectation of him, he would never have had time to be alone with God.
Boundaries are not selfish when we use our freedom to serve and love one another because we are keeping our own flesh under control (Galatians 5:13). In a godly relationship, both people are free to love each other and to be themselves because neither is using or manipulating the other. To know yourself and be secure that you are loved is essential to all relationships and activities. The better your boundaries of self-awareness and self-definition are the greater your capacity to offer empathy and love to others.
Good boundaries help you to care for others because you have a stable foundation to operate from and are not distracted or depleted by personal insecurities or blind spots. That's why it's not 'selfish' or unloving to have boundaries and 'take care of yourself.'