I've been doing a LOT of upgrading lately, because I was starting to get close to that limit. I don't imagine everyone goes about it the same way, but I'll share what I do.
The choice of what to upgrade first depends on several factors - look at what will cut into your profits the least, what will take less time to complete upgrading, and what will benefit best from upgrading (i. e. free up the most plots upon completion, etc.). Sometimes one of those three concerns outweighs the others.
First I sit down and make a plan. I figure out what level each building should be upgraded to, in order to make the production numbers even throughout each production line. This early in the game, I'd rather keep it to upgrade level 5 or below if I can. Down the road, when I'm approaching that building limit again, I'll upgrade them further. But for now, I'd rather not spend all that time and cash on higher than that unless it's necessary.
Once I've done that, I'll look over my list to get an idea of some good choices to start with. If I can over-produce it first and save up a stockpile, or if there's a steady supply at a decent price on the market, then I'll still be able to sell it in my shops while I'm upgrading those buildings.
That's not always possible, of course. If I can't come up with a stockpile, I might only upgrade a section of the production line at a time - such as upgrading one cattle farm and one icecream factory, rather than all the icecream production buildings at once. It'll still cut into my profits, but not as much as if I shut them all down at once. I'll also keep a close eye on the market to see if I can catch any replacement in the meantime.
The higher along the production line you go, the less buildings are needed. To make tea, for instance, I needed quite a few logging camps in proportion to the number of food industry buildings. Sometimes it makes sense to start with the bottom and mid level buildings. I'll use a stockpile of mid-level materials to keep my factories working. Once I've got those bottom buildings further along, I'll start upgrading those factories (preferably with a stockpile of the finished product to sell). If I don't time things exactly right, my bottom and mid level buildings might be ready before those factories are. But any excess materials I produce from those can be sold on the market, so I'm not all that particular about it.
The reason I often do it that way is because when I've tackled the entire production line at one time, I've generally ended up with the end buildings ready far ahead of the others. That can mean that some have to sit at standstill while the others catch up, which is somewhat of a waste. But that's not always the case either - sometimes I can get the mid level material from the market so my factories won't sit idle. Either way, of course, it's a bit simpler to do the whole production line at once - it requires less planning and less watching.