Yes, my anecdotal conversations with people who post these things is that that's mostly how they happen. The closest I ever get to writing the whole thing out ahead of time is just writing two or three posts worth of text into the reply box and then splitting it up before posting. Maybe e.g. journalists or writers with more long-form experience do sometimes write out their whole thread ahead of time and then post it, but I think that's a very small percentage.
Yeah, good question. Most of the threads I see are marked e.g. 1/, 2/, without a set end number, so yeah, I would expect that most ones that DO have it are composed in advance. (Although maybe not always posted all at once, because people definitely do still elaborate & extend on points and sometimes overrun their "pre-written script"). For example one Twitter user I follow who I most expect to write his threads ahead of time is Bret Devereaux, since he has significant long-form blog experience where he puts a lot of thoughts into high-level structure, pedagogy, etc. However, this thread of his from this morning does't have a set end-point: https://twitter.com/BretDevereaux/status/1610457226451484672. I wonder how it was composed?
(For example, notorious thread-poster Foone elaborates on their process/why threads work for them here: https://foone.tumblr.com/post/700185724820078592/one-of-my-f...)