Okay, so let's fill in the details on Ville's nice argument in the comments: there is no such bound, and to prove this it suffices to exhibit a sequence of finite perfect groups whose ranks are unbounded. We'll take the sequence $A_5^n$ to be concrete although the argument applies to powers of any finite perfect group. If we take $k$ elements $\{ g_1, \dots g_k \}$ of $G_n$, their projections to each copy of $A_5$ can take at most $60^k$ possible values, so by pigeonhole there's at least one subset of the indices $S \subseteq \{ 1, 2, \dots n \}$ of size at least $\left\lfloor \frac{n}{60^k} \right\rfloor$ such that the projections of the $g_i$ to each copy of $A_5$ indexed by each $i \in S$ are the same. If $|S| \ge 2$ it follows that $\{ g_1, \dots g_k \}$ can't generate $A_5^n$, hence
$$\text{rank}(A_5^n) > \log_{60} \frac{n}{2}.$$
In the positive direction, Burnside's basis theorem implies that $\text{rank}(G) = \text{rank}(G^{ab})$ if $G$ is a finite $p$-group.
Edit: It's maybe also worth mentioning that we needed to do this construction because it doesn't suffice to just take, say, arbitrarily large finite simple groups; it's known that all nonabelian finite simple groups have rank exactly $2$.