As humans we're affected by the environment around us and the people who we surround ourselves with, because we are social beings and have survived for many thousands of years through being in communities/tribes. Thus, if you surround yourself with lazy, negative friends or family then you are likely to be influenced by these views and adopt them as well - you'll start becoming just like them. Likewise, if you surround yourself with people who are closed-minded, xenophobic with a "us-vs-them" mentality, you will start becoming like this yourself. If you resist, you will create conflict in your family every time the issue comes up.
It's your responsibility to surround yourself with people who have a positive, healthy outlook on the world. Yes they're your family, but do not be afraid to limit your contact with them so that you can live a life with positivity and love for all people. Lead by example - be kind and understanding to your family, but always observe the way your family acts and remind yourself that this attitude will not get you far in your own life. Let your family be a lesson to you so that you and your future children will never think or act in this manner.
As mentioned above, you don't choose the family you're dealt in life, but what you can choose is whether you will let it bring you down or if you'll be willing to learn from it and never allow it to happen in your own life. As for "spiritual foundation", I recommend studying philosophy and setting yourself some goals and let those be the driving forces within your life. You don't have to subscribe to a religion that is filled with outdated, flawed and false beliefs just to live a happier life. Take the principles that will make you and those around you happier (e.g. positivity, kindness, generosity, honesty, courage etc.), turn them into habits and live as the best version of yourself. You don't need religion and all the baggage that comes with believing in fairytales.
So, I'd suggest limit your contact, make friends with a positive attitude, do not be afraid to say "no" to certain beliefs and let your family be a lesson to you.