Former gentle parent here! I am not "un-gentle" - I still agree with 80-90% of the principles behind what I used to think of as "gentle parenting" - but I found that some of the common stuff which gets repeated a lot was counterproductive, mainly because I have a tendency towards being too lenient/letting empathy get in the way rather than a natural tendency toward being too strict.
How do I stop shouting after being calm for so long?
IME, this happens when you're drawing the boundary much too late. Say "enough" and walk out of the room earlier, before you get to the point of raging. You remaining calm for the previous things is completely pointless if you're going to lose it later - and it's not actually drawing a boundary or communicating that you find the behaviour unacceptable, either, so it's not likely to stop the behaviour.
In your example first you ignored him saying (multiple) horrible things, and then you sat there while he hit your book for 15 minutes - this is way too long because during all of this extremely trying behaviour, you're building up frustration and annoyance under the surface which is liable to explode out. So you need to interrupt the cycle before all of this builds up. It is also much clearer in terms of which behaviour you accept and which you don't, when you react to behaviour you don't like immediately, rather than giving him a chance to stop on his own. Your reaction doesn't have to be harsh, scary or anything, it just has to be consistent which means you always react to that behaviour, you don't tolerate it for 15 minutes sometimes and for 2 minutes another time etc. It's not acceptable, so don't accept it at all!
So decide where you're going to draw the line - whether it's the horrible things, or that he needs to lie still/quiet if you're going to stay after reading or after you have stopped reading due to behaviour. Explain this to him at a time when he is not tired. Remind him of this changed expectation at the start of your bedtime routine.
Then follow it through calmly from the FIRST SIGN. So if he says something or starts to try to get your attention 1x, don't wait and give him a "chance". Say "No DS. I don't want to hear that. I'm going outside to calm down. If you're quiet, you can have one more chance."
Leave the room - do some deep breathing or whatever you need to do to keep yourself in a steady headspace. Re-enter the room and remind him of the expectation. If he does the behaviour again or something else in the same category, then say "Right that was your last chance. We can try this again tomorrow night. Goodnight DS, love you." Then leave the room - he will rage and scream and cry and all you do is be a broken record - "You have lost your chance for tonight. We can try again tomorrow. Night night."
You need a very calm, rehearsed, boring response to any pushback - so don't get involved in trying to wrestle the door closed or "making" him stay in. Let him come out (simply to avoid a wrestling match) and then either tell him or walk him back to bed calmly. This may take dozens of repeats, but the important thing is to keep your own response calm. You are not engaging in a power struggle or a strength competition with him, you are simply holding the line that you will not sit and listen to him saying horrible things, or you will not sit with him if he's not lying calmly going to sleep. And he has not lost his chance forever, he can try again tomorrow. But not letting him have endless chances means that you are making your stance clearer AND it means that you can respond to the behaviour before it drives you to rage.
If he will not be led back to bed, you can either ignore him if this is possible for you, threaten a consequence e.g. loss of screen time the next day and count down from 3, or if you are at an absolute loss, shut yourself in another room e.g. the bathroom or your own bedroom with your back sat against the door. He will eventually get bored or tired and give up. If you stay consistent with responding this way, he will learn that you're not going to change your mind and come back in, no matter what he throws at you - that is what a boundary is.
We haven’t usually given a consequence as I can’t think of one that related to what he’s doing?
It is actually a complete myth that consequences need to be related. It sounds logical but it doesn't actually work like that. I think what this is is really guilt-assauging because nobody likes using consequences and there are also a lot of really good, solid arguments against them, so a lot of internet parenting discourse gets confused because it's mixed up between an older belief that consequences are THE effective tool, and the newer idea that they can have downsides, so it's a sort of "How to use consequences, while not having them be consequences". This is a fallacy. Most of the time I find you don't necessarily need a consequence, but they can be useful in terms of making a very clear point of marking specific behaviours which are difficult to replace directly. But anyway, making them related vs not really doesn't make any difference. If you're using a related consequence as an opportunity to teach repair/restoration or for them to understand the IRL consequences of what they are doing, then just do that without emphasising it as a punishment because that's secondary. And if you're holding a boundary as described above, then it doesn't necessarily need a consequence further to that, but sometimes consequences can be useful as the backstop to a boundary.
What actually matters with consequences is that 1. They are being used in conjunction with teaching/encouraging/rewarding the replacement behaviour that you DO want, or the skill that is needed for this, and you're making an attempt to understand the behaviour and communicate with the child. A consequence will not do anything on its own. 2. That they are used consistently, not intermittently (the same behaviour from the child gets a response from you every time and is not sometimes let go or ignored) and as close to the behaviour as possible, and 3. That they are repeatable and temporary (and as a bonus go for something small/minor). This is because the size/severity of the consequence doesn't actually matter. A small consequence is just as effective as a big one, so why bring all the downsides of a big consequence when you can use something minor? It also helps parents who (like me and maybe you, OP!) lean on the side of letting empathy get in the way of discipline, AND the smaller you make it, the less likely you are to run out. Something you want to avoid is getting into a trap where you're taking so much (e.g.) screen time that it stretches on and on and on into the future and it ends up being meaningless as well as you then have nothing else to take away. If you have a generic/token, small minor consequence then you don't feel so bad giving it because you know 100% they can handle having 5 mins less screen time or whatever it is, even if they create about it in the short term. This helps teach YOU, the overly-empathetic parent, that it is OK to say no and reject certain behaviour, it does not mean you are rejecting the child's entire being, and it also helps teach the CHILD that they can handle making mistakes, accepting the consequence, and it is not some terrible rejection nor the end of the world.