Three‐layer flows in the shallow water limit