Originally Printer nodes were the only ones with "side effects". So it was ok to essentially prune any part of the stream graph that did not contribute to some Printer node endpoint.
However, UDFs often have side effects, pruning terminal UDF nodes is NOT a safe optimization. This should be fixed.