It pretty much as you have described, no need for an invasion some countries just let you in. I know this concept is hard to understand but it’s true! 😂
To answer your question he can leave on a UK passport, he will not need a Thai one. Once it’s explained to the immigration staff that he’s just been born and therefore there is no entry stamp in the passport they will make a hand written note to this effect. That’s what happened with my Son.
One thing to note, if you’re not aware, even if you’re on the birth certificate, as a father you have very few rights in Thailand. All the power sits with the mother.
A lot can happen in 5 months, you might of invaded the place by then! No difference in registration whether your Thai, foreign or identity as a teapot. You’ll end up with one of these.