You learned that, despite the fact that you negotiated to be paid by output rather than time, the pay that the company was comfortable with was actually based on their impression of the time it would take to build each page. If they had known you could automate it, they likely would have expected you to agree to a lower per-page fee.
I don't think you did anything wrong, but I don't blame them for being annoyed. Essentially you were a shrewd negotiator, and "won" that interaction, and _that_ was annoying.
But yeah, as a sibling said: don't tell people how the sausage is made. If it's clear up front they're paying for the sausage, and not for the time it takes you to make it, I'd say you're ethically in the clear.