Probably two things to untangle here:
(1) The flight attendant making up arbitrary explanations for why they choose not provide certain service (like "sorry, I am required to open this can of Coke before I give it to you because an unopened can of Coke might be a weapon") is just par for the course on UA and in fact all American legacy carriers.
Staff are required follow crazy internal policies about how to do the meal service and those policies make no logical sense; no surprise that if you sometimes ask a crewmember to explain the policy you'll get a crazy-sounding explanation. Having had or overheard equally ludicrous interactions with flight crew several times in the past, I am sure this happened more or less exactly as described.
Should UA apologize for having crazy made-up illogical rules and having staff whose only rational reaction in response to their crazy made-up rules is to make stuff up? Yes, but this apology would take them years. It's not racism, it's just dumb bureaucratic inertia.
(I don't think this pax is in the wrong to, per her account, demand that she receive an unopened can of Coke and to reject even a just-opened can as bad in some way, like potentially somehow contaminated or difficult to squirrel away for later use. It's a reasonable thing to ask for, even if UA policy prohibits doing it because they want to save the 50 cents per can of Coke breakage or whatever. A better reply would have been "sorry, policy says I can't do that" full stop…)
(2) The other passenger who was mean to this pax and allegedly said bad things about what they assumed to be her religion is probably just a bad person or a person who was having a bad day and said stuff that, later in life, they will or should deeply regret.
Should UA apologize for their staff not reprimanding that guy for being a jerk? Probably, yeah; a courteous member of the flight crew would go above and beyond their stated job role to encourage pax not to be mean to one another.