The two sections bolted together sound like a flange used on larger sizes water mains.
This could be a “fish trap” as many LOCAL DEP codes do require them.
It could also be a check valve as older systems did rely on these dvices as a back flow preventer.
It could be a strainer as they also were popular devices to be installed especially for well or other sandy water conditions.
Sight unseen is could be almost anything including a pilot valve used to control other apparatus like a high water/low water alarm like we use of fire supression combination systems coming off the domestic supply.
You didnt menthion the size of the building main or the use like commerical etc.
Sure is fun taking a shot in the dark HUH? LOL