Magnetic Fields in Star-forming Molecular Clouds. III. Submillimeter Polarimetry of Intermediate-Mass Cores and Filaments in Orion B