I think many polyamory stories begin out of confused monogamy. So your story is not too unusual. You get a life lesson.
You can't help who you fall in love with. You can only try to be as ethical as you can. In hindsight, S should have had a poly talk with A and see how that played out. But you can't undo the past.
We are all human and make mistakes. Just learn from them and keep going forward.
I hope the best for you.