There is no restriction per se1 and some professors are happy to have long-term postdocs, but such people rarely transition to better positions in the field.
Note hard statistics are going to be difficult to come by. I've been trying to get some sense of postdoc trajectories in astronomy for years, but everywhere I turn it's just self-reported numbers, selective memories, and cagey responses about how people who left the field ultimately wanted to do so. As a result, all I have are my own anecdotal observations from within the astronomy.
One sobering thought to keep in mind is that if you weren't "good enough" to get the permanent job of your dreams after 2 postdocs, there's no reason to think you'll be any better off after 5 postdocs. Remember, each year there is a new batch of PhD graduates entering the job market, with roughly the same distribution of hireability from year to year. Moreover, permanent positions are not rewards for a career well done; they are promises of stable employment in exchange for future research. After a 1st or 2nd postdoc, the potential employer is still making a guess about your future. After the 5th, if you haven't done professor-level work, you're statistically not likely to have a mid-career change of pace. Dwelling for a long time in postdoc limbo really amounts to hoping for statistical fluctuations to help you out one year in the job market.
A number of faculty (especially successful ones who attract good job applicants) do not even want to hire 3rd- or 4th- or 5th-time postdocs. Part of the value of postdocs, as far as the professors are concerned, is in raising successful academics. They want postdocs who will soon become faculty themselves, since then the community can say "yes, all those well-known researchers did indeed work under Prof. Bigshot." Thus your proposed plan might be more difficult to attempt than you thought.
Other professors, though, are all too happy to keep good researchers by their side. Getting someone with a decade of post-PhD experience for the price of a postdoc -- that's a great deal. They'll keep paying you as long as you keep working. At this point, though, it's not clear you don't have a permanent position of sorts. Often such people also obtain different titles, like "researcher" or "technical staff."
Furthermore, the career you have in mind -- many years of solid research under others' direction -- is not that different from astronomy positions outside universities proper. Various NASA centers, national labs, and large telescope facilities have permanent staff scientists working for them. If your goal is a position like this, there's no particular reason to idle around as a postdoc.
If your goal is a tenured faculty position, then yes it is somewhat difficult (but by no means impossible) to switch from a non-university staff scientist to tenure-track (or even tenure in rare cases). However I don't believe it is any more difficult to do this transition than to get such a job with 15 years of postdoc experience. Even if the research is the same, the latter comes off a bit unusual and leaves less room for asserting your scientific independence.
In summary, if you are considering this plan, perhaps you should look into astronomy careers outside universities instead.
1This is written from a US perspective, which has the largest fraction of astronomy jobs anyway. In the US, "postdoc" is in no way a regulated term. It's just the least-prestigious post-PhD position in the field, usually filled by wandering journeymen for 2-5 years at a time.