I really don't think there is any objective amount, for a lot of the reasons that have been said. I feel like as your sense of taste improves, you'll start to understand how quickly something becomes boring, and you can sort of use that as a good idea - when you start getting really bored with any one particular loop, it's probably time to introduce some variation.
In the meanwhile, I consider this a good baseline for the most common kinds of dance music you see out there (and VERY easily broken to fit whatever arrangement you're working in):
For melodic stuff, there should be some sort of slight variation on an element every four bars, some sort of fill every eight bars, and a big change every sixteen bars.
For rhythmic stuff, build a 2 bar drum loop that doubles and gets a small fill on the fourth bar, doubles and gets a larger fill on the 8th bar. have a percussive element of some kind show up on a 2 bar loop and a 4 bar loop. duplicate that and put some variations to the twelfth and sixteenth bars, then put accents on a few of the kicks and/or snares, add some sounds to announce that the "loop" has progressed to a new section (crash on the 5 & 13, white noise on the 9 for example)
For some video tutorials on this sorta stuff, I'd suggest the
Rusko Masterclass and this
SeamlessR tutorial on drop arrangements. As you develop your own style you'll find how to tweak these ideas to suit your needs, but it never hurts to have something to use as a launching board!