at turn 9, I had 18 shields, 18 food and 35 gold accumulated and was making 2/2/3 per turn.
at turn 10, one of my citizens was working on the cattle and the other one became an entertainer. I had 21 shields, 0 food, 38 gold...so I received 3 shields (I didn't improve any tiles, so the second citizen must have gone to a shielded grassland)...but he didn't work on the cattle although the city had expanded this turn.
I think it works like that:
1.) money (as even unhappy cities continue to produce gold, it doesn't make a diffrence whether money or unhappiness comes first...not in most cases at least

2.) check if the city is unhappy...if yes, it does not produce any food/shields
3.) growth
4.) shields...that's why you get the shields from two citizens
5.) border expansion+reorganization of the citizens. here, the governor checks whether the city would become unhappy with its bigger size again and employs entertainers if necessary