This is so hard. Dwelling on what you should or should not have done in the past is not likely to help except in terms of reflecting on what to do differently in the future. Try not to get bogged down in shame with this - it can be paralysing, and that doesn't help anybody.
I found a lot of help in a book called Big Baffling Behaviours by Robyn Gobbel. My children are not traumatised, but my middle son had some very challenging behaviour when his ADHD was less well managed. The book explains polyvagal theory in the context of children's behaviour, which is extremely useful/practical (IME).
The only thing I disagree with in the book is that it completely rejects any kind of reward/punishment model being used and I disagree. While the understanding side is hugely important, I also think it's important to be really clear around which behaviours are acceptable vs unacceptable, even if the behaviours were a stress response, and often an external clear structure using reward and punishment is helpful with this. No punishment needs to be harsh or frightening - in fact it definitely shouldn't be, because that is counterproductive. Ideally any punishment should be minor, token, and temporary. But children who have been living in survival mode for a long time often need clear direction, and can benefit from the addition of extrinsic motivation because it helps them to orientate their own intrinsic motivation towards social rules rather than survival.
The other thing that I find is helpful about having a structure which uses set, predictable, consistent reward and minor punishment in relation to specific rules is that it helps avoid reward and punishment being used as tools in a power struggle. What we quite often naturally want to do when a child is misbehaving or we feel we need to regain control of a situation is that we try to get them to back down by verbally wielding a bigger "stick" - making more threats, or reminding them of the rewards they stand to lose, as a kind of threat. When children either cannot meet the adult expectation in that moment, or they have gone into a threat response, then what you will find is that wielding "threats" makes the child's behaviour escalate, in turn the adult often escalates and the situation can spiral ending in either the child backing down and complying, but the adult feels guilty because they were more harsh than intended, or the adult abandoning the attempt and the child escapes the demand. This is called the coercive cycle, because it is highly likely to be repeated - the child repeats the escalation because it sometimes works for them to escape, the adult repeats the escalation because it sometimes works to gain compliance. But it will increase defiant/oppositional behaviour overall, which is not what you want as a bigger picture, and it's also very chaotic and frightening.
What is usually better is to have the clear rules with small token reward/penalties for infractions and most rules (e.g. no shouting, no violence) should apply to everyone including the adults. Children often appreciate BTW if adults also do something like take time out if they have a moment of frustration and break a rule. Something like a bedtime can obviously be different for adults and children. But this way when something happens and the adult wants to remind the child of the rules, it's not a battle between you and them, you're just reminding them of the consequences and then it's up to them to choose. It also models that if you make a mistake, or if someone is unhappy with something you did, it doesn't necessarily mean that your entire worth as a human and/or relationship with this person is now in jeopardy. It was just a mistake and we can accept the consequences of the mistake or take on the new information and move on with life, perhaps doing something to put it right etc. Often children who have experienced or witnessed abuse can be afraid of owning up to mistakes or hearing any kind of criticism/feedback, because this was dangerous in the abusive situation, but safe relationships are not like that and it is important to learn how to deal with mistakes and criticism in a safe environment.
If you're finding repeatedly that a child is ending up with the consequence rather than following the rule, then it can help to explore whether the expectation is currently too high and either needs breaking down into smaller steps from where they are now to where you want them to be, or whether the child needs more support e.g. with an underlying skill, or some kind of environmental support e.g. a task prompt list, or whether the expectation is right for them e.g. maybe they are not tired when you want them to sleep. But having the system of rules and consequences be almost separate to your relationship is really important (IME) because that way it can be you and your child against the situation they need to master, rather than you vs them.
I quite like the books by Cathy Glass / Casey Watson, fostering memoirs. Take them with a massive pinch of salt, obviously, because it's clear they are at the very least fictionalised if not fully invented despite being marketed as true life stories. I'm sure the actual progression of behaviour/trauma processing is neatened up substantially, and there are a lot of convenient/unrealistic happy endings. But what I like about them is that they set out a very clear and simple illustration of how day to day life can look when you're trying to establish structure, boundaries and safety for a child who has experienced not much of any of it and who has challenging behaviour to manage day to day, and they both have this kind of thing where the caregiver uses reward and punishment without it being a power struggle or an adult vs kid and who "wins" kind of thing, so they are helpful to see how that kind of thing can be implemented.