The MiG-23 has a very nontraditional landing gear setup. Why has it been designed the way it has as opposed to the more traditional method of a single compression strut that is raised into the fuselage.
This configuration for the main landing gear was necessitated by the fact that the MiG-23/27's narrow fuselage combined with limited internal real estate in that section of the airframe made that type of retraction mechanism the best compromise in terms of fit, weight and providing a wide wheel track for the aircraft to facilitate operations on rough or unpaved airstrips (typical Soviet utilitarian philosophy for going to war).
An angled MLG strut which retracted forward such as that found on the F-104 or F-16 airplanes was not possible due to the side fuel tanks just aft of the engine inlets.
Aircraft which have narrow fuselages and high mounted wings are always going to require a more unorthodox retraction configuration for the main landing gear due to space limitations. Other examples of this include the Dassault Mirage F1, Su-24 Fencer, and SEPECAT Jaguar.
This placement of the MLG and in this retraction configuration was the best available for the design limits.
That landing gear reminds me of that of a Wildcat.
Note they both share a narrow track and a collapsing retraction into the fuselage.
Granted the MiG-23 has less braces and struts, but that's down to advancements in material engineering. The Wildcat needed a tall landing gear for the propeller clearance.
The traditional arrangement you're referring to is one where the landing gear extends down from the wing, and retracts into the fuselage.
The MiG-23's wing is movable, a variable geometry wing, which isn't the best place to mount a landing gear.
In order to accommodate the whole mechanism into the fuselage while not wasting space, this method is used.
The other option would be a swinging mechanism, like that of the F-14, which also has a variable geometry wing.
The F-14 needed such mechanism for landing on aircraft carriers. Narrow and short landing gear is not good when your landing is more of a controlled crash.
Length is needed to absorb the impact energy; wide track is needed for grabbing on the deck far from the center of mass, so the plane wouldn't flip and the landing gear wouldn't collapse.
When that's not needed and space is at a premium, such collapsing mechanism is used. Here's a video of the MiG-23's landing gear in action.