Stacked networks improve physics-informed training: applications to neural networks and deep operator networks