All‐Photonic Miniature Perovskite Encoder with a Terahertz Bandwidth