Was it not highly lucrative for Indonesians to be involved in the spice trade? And if so, why didn't that practice spread to the Philippines given its similarity and climate and agricultural conditions? Were the Spaniards confused by this? Why wouldn't they just begin producing spices there as well?
Prior to Spanish colonization, Filipino natives did engage with trade with the rest of Southeast Asia to a certain extent, spices included. But in the era of Spanish rule, the Spanish colonial empire was primarily concerned with its holdings in the Americas, which already had vast amounts of slave labor and natural resources (particularly silver, which was one of their main exports to China). On the other hand, due to their Philippine holdings literally being an entire ocean away, it was not as convenient for Spain to send as much manpower in consolidating resource extraction and/or economic development in that region up until the early 19th century. Within that period, the Spanish government's most important holding in the Philippines was the port of Manila, which was involved in the spice trade in another way entirely: as an entrepĂ´t through which Chinese goods (and spices) flowed to Mexico in exchange for Spanish silver as part of the Manila-Acapulco galleon trade route.
The Spanish bureaucrats that happened to be stationed in the Philippines mostly stayed confined within the walls of Manila to profit from the galleon trade. The few Spaniards that were willing to be stationed in the Philippine countryside were mostly the friars of Catholic mendicant orders that were more interested in a servile native populace than in fostering an economic revolution. As a result, most Philippine rural economies practiced subsistence agriculture and produced little surplus up until the galleon trade ended.
The Spaniards began to move away from the galleon trade for several reasons: firstly, the British invasion of Manila in 1764 - in addition to the constant incursions of Dutch privateers, Chinese pirate warlords and Moro raiders - drew Spain's attention to the vulnerability of their Pacific colony to outside attacks. Secondly, British naval dominance in the world's oceans meant that other countries were also beginning to trade directly with China. And finally, Mexico's independence from Spain in the 1820s ended the era of governance from New Spain.
All these made the Spaniards realize that they had to start to make good use of the rest of their Philippine colony. This was primarily realized with Spanish economic reforms in the 19th century that developed the Philippine economy towards export-oriented agriculture. Under these reforms, Philippine ports were opened up to international trade, restrictions on Chinese immigration were gradually lifted, and the tobacco monopoly was abolished. The majority of Philippine exports then became "cash crops" like abaca, sugar, tobacco, and coffee (which the Americans would take advantage of in the future). Even then, Spanish domination of the economy was limited by the investments of British and American trading houses and the rise of a Chinese mestizo class, so much that a visitor to the Philippines described it as "an Anglo-Chinese colony flying the Spanish flag". Eventually, these Chinese mestizos would go on to acquire even more land (displeasing the friars) and would send their children to study overseas and bring back liberal ideas (further displeasing the friars), sowing the first seeds of the Philippine Revolution.
So in conclusion, Spain utilized the potential of Philippine agriculture late into their lifetime as a colonial empire, and were not even able to control it to their advantage anyways.
Unfortunately the Dutch occupation of Indonesia is not my specialty and I would probably be making some ahistorical claims if I tried to answer you on that part.
State and Societies in the Philippines (2nd ed.) by Abinales and Amoroso has a decent summary on how these economic developments impacted the formation of the Philippine state. In particular, A Captive Land by James Putzel analyzes how the agricultural economy contributed to the agrarian land reform problem, one of the Philippines' most pressing economic issues today.
EDIT: To add, After The Galleons by Benito Lagarda seems to be the one of the most in-depth sources on this subject, of which a provisional text can be found here. However, I can't seem to find a way to access the book itself at the moment
EDIT: words EDIT 2: words again