You need to break 250k+ blocks to obtain the Legendary Rock Pet. Your collection does not matter, because it only counts the blocks you break (1 block broken = 1 block added in Rock Milestone) and not you collect from minions etc sources. While grinding, you'll also acquire Common, Uncommon, Rare, and Epic Rock Pets, Sell these additional pets for extra coins.
TIP: don't sell legendary rock pet use it to get magic find.Avoid selling the Enchanted Cobblestone you collect during the grind. Instead, use it to craft Super Compactors and place them in your minions to boost their productivity.
Be cautious with your spending and avoid wasting coins. Save the coins earned from selling Rock Pets to support your future upgrades and progression.
Check out this video for guidance on building a Pumpkin Farm.