I think it is explained in your OP. We do the same thing with a bit more detail.
Since we have already counted the number of "bad" positions with all the boys together, it remains to count the number of bad positions in which the boys are not all together, but some boy is not next to a girl.
There must be two boys together, and they must be at the left end or the right end ($2$ choices). Take such a choice, say left end. Then the remaining boy can be in any one of $3$ places, namely positions $4$, $5$, or $6$. That gives us $(2)(3)$ ways of choosing the seats the boys will occupy. For each of these $(2)(3)$ choices, there are $3!$ ways of permuting the boys among the chosen seats, and for every such choice there are $3!$ ways of permuting the girls, for a total of $(2)(3)(3!)(3!)$.
Another way: Counting all possible arrangements and subtracting the "bad" ones is often good strategy. But let us count directly.
Our condition will be satisfied if either no two boys are together, or exactly two boys are together and they are not in the end seats.
Count first the arrangements in which no two boys are adjacent. Write down $G\quad G\quad G$. This determines $4$ "gaps" into which we can slip the boys, one boy per gap. There are $4$ "gaps" because we are including the end gaps. There are $\binom{4}{3}$ ways of choosing $3$ of these gaps.
Or else we could slip $2$ boys into one of the two center gaps ($2$ choices), and then slip the remaining boy into one of the $3$ remaining gaps, for a total of $6$ choices.
Thus the places for the boys can be chosen in $10$ ways. For each of these ways, we can arrange the boys is $3!$ ways, and then the girls in $3!$ ways, for a total of $360$.
I think of it this way. One of the girls is the Queen, and one of the chairs is a throne. The Queen of course sits on the throne. The rest of the girls can be permuted in $3!$ ways, and the boys in $4!$.
Remark: The problem with deciding that we will divide by something is that then we are doing manipulation and not visualization. I prefer to keep things concrete, to retain control over the counting process.
Best Answer
Give the boys a number. For boy $i$ let $G_i$ denote the number of girls that sit next to him.
Then you are searching for: $$\mathbb E(G_1+\cdots+G_9)=\mathbb EG_1+\cdots+\mathbb EG_9=9\mathbb EG_1$$
Let Alex (the boy having number $1$) take place.
The probability that Alex will get $2$ boys as neighbor is $\frac{8}{15}\frac{7}{14}=\frac{4}{15}$.
The probability that Alex will get $2$ girls as neighbor is $\frac{7}{15}\frac{6}{14}=\frac{3}{15}$.
The probability that Alex will get a girl and a boy as neighbor is $2\frac{8}{15}\frac{7}{14}=\frac{8}{15}$.
So $\mathbb EG_1=0\times\frac{4}{15}+2\times\frac{3}{15}+1\times\frac{8}{15}=\frac{14}{15}$
We come to an expectation of $9\times\frac{14}{15}=\frac{42}{5}$ switches.