Here are two contexts in which such conclusions follow.
Strong reflection axioms. Consider the strong reflection axiom, sometimes denoted $V_\delta\prec V$, which is axiomatized in the language of set theory augmented with a constant symbol for $\delta$, axiomatized by the assertions $$\forall x\in V_\delta\ \ [\varphi(x)\iff \varphi^{V_\delta}(x)].$$
This theory is a conservative extension of ZFC, since every finite subset of the theory can be interpreted in any given model of ZFC by the reflection theorem. Meanwhile, in this theory, if the cardinal $\delta$ (or any larger cardinal) has a property $P$ expressible in the language of set theory, then $V$ satisfies $\exists\kappa P(\kappa)$, and so $V_\delta$ also satisfies this assertion, so there is a $\kappa\lt\delta$ with $P(\kappa)$. Similarly, if the collection of cardinals $\kappa$ with $P(\kappa)$ is bounded, then $V_\delta$ would have to agree on the bound by elementarity, but it cannot agree on the bound since $\delta$ itself has the property. So the collection of cardinals with property $P$ must be unbounded in the ordinals.
A stronger formulation of the strong reflection axiom includes the assertion that $\delta$ itself is inaccessible (or more), in which case it carries some large cardinal strength. It is exactly equiconsistent with the assertion "ORD is Mahlo", meaning the scheme asserting that every definable stationary proper class contains a regular cardinal, which is weaker in consistency strength than a single Mahlo cardinal.
Another seemingly stronger formulation of the theory, but still conservative over ZFC, is due to Feferman, and this asserts that there is a closed unbounded proper class $C$ of cardinals $\delta$, all with $V_\delta\prec V$. This theory can be stated as a scheme in the language of set theory augmented by a predicate symbol for $C$. Feferman proposed it as a suitable substitute and improvement of the use of universes in category theory, because it provides a graded hierarchy of universe concepts, which moreover agree between them and with the full universe on first-order set-theoretic truth.
The maximality principle. The maximality principle is the scheme asserting that any statement $\varphi$ which is forceable in such a way that it continues to be true in all further forcing extensions, is already true. This axiom is the main focus of my article, "A simple maximality principle", JSL 62, 2003, and was introduced independently by Stavi and Vaananen. The axiom asserts in short, that anything that you could make permanently true in forcing extensions, is already permanently true. The point now is that under MP, one gets your phenomenon:
Theorem. Under MP, if there is any inaccessible cardinal, then there is a proper class of such cardinals. And the same for Mahlo cardinals and many other large cardinal concepts.
Proof. Assume MP. If there are no inaccessible cardinals above some ordinal $\theta$, then consider the forcing to collapse $\theta$ to be countable. In the resulting forcing extension $V[G]$, there will be no inaccessible cardinals at all, and there never will be such cardinals in any further extension (because any inaccessible cardinal of $V[G][H]$ would also be inaccessible in $V[G]$). Thus, in $V$ the assertion that there are no inaccessible cardinals is forceably necessary, and so by MP, it must already be true. Thus, under MP, either there are no inaccessible cardinals or there are a proper class of them. The same argument works with Mahlo cardinals or any large cardinal concept that is downwards absolute. QED