Last I heard in the news, they've already banned male Ukrainians from fleeing the country and are arming them so those other nationalities are probably gonna be able get out now.
Could have used a better system sooner though, like reserve a certain portion of seats (or maybe one coach) for the non-Europeans.
I think you should call your embassy and ask them to provide help. Bear in mind that EU is officially aiding Ukrainian refugees as they are in the most need, but if you are classified under other categories (e.g. students, other workers,...) it should be your diplomatic services providing engagement and means with the local authorities. You may actually do not have a legal right to cross to Poland without some short of process.
This is not a justification for discrimination as such. Everyone has to be treated humanly and not left to die simply on a compassion basis.
We don't know the details in the video shown but maybe that's what happened? I'm watching our own local news and they said they are repatriating our workers out of Ukraine so I'm assuming there are arrangements on where the people would be picked up. If their contract is for Ukraine only then they really can't just cross into Poland since UKR is not an EU member and so not part of the Schengen Agreement.
Maybe that train was really for Ukrainians only and it hasn't been made clear to those Africans and they tried to board it? If they managed to get into Poland they'd also probably have problems there.