Lets talk about the Yak-28P and Yak-28B/L/I separately.
The Yak-28P basically got a free ride to production not on its merits but due to the appalling reliability of the AL-7F engine which powered the Su-9/11 in the early 1960s. Late production AL-7F managed to struggle to 100, 150, and finally 200 hours service life (not TBO!).
More than half of the 20 Su-9s lost in the first 18 months of service were due to engine troubles. The only bright spot in fighter engine production in the USSR at this point was the R-11-300 engine, which was proving reasonably reliable in the MiG-21. Therefore Su-9 production was terminated and Su-11 production drastically cut, in favour of the Yak-28P (which, by virtue of using the R-11-300 and being twin engined was thought much safer) and MiG-21 developments.
It is important to realise that the USSR had just had its own equivalent of the Sandys White Paper. In 1958-59 35 aircraft projects and 21 engine projects were cancelled as obsolete in the new "missile age". Therefore only "modifications" of existing designs were permissable. The PVO were deeply unhappy with the Su-9 and turned to the Yak-28P instead, which as a modification of an existing type would be allowed into production. Also, the engine arrangement of the Su-9 gave too little room for an effective radar to be fitted, and the Yak-28P would fix this.
In service Yak-28P proved almost as unreliable as the Su-9. Its engines were too widely spaced to help in the engine-out situation, and ironically some problems surfaced with R-11F2-300 reliability . Its performance was distinctly lacking compared to the Su-9 - ceiling and top speed were much lower. It suffered from dangerous aileron reversals. On the bright side range was longer, and the radar (when it worked, which wasn't very often) superior.
924 Su-9 and 72 Su-11 were built. By contrast, only 436 Yak-28Ps were built in 4 years of production. Replacing the Yak-28P, 1,247 Su-15s were built. With the Su-15, Sukhoi fixed the two problems (engines and avionics) of the Su-9 and quickly replaced the Yak-28P in production. In desperation, Yakovlev sent his son to the Novosibirsk production line in 1964 as it prepared for Su-15 production to obtain details of the new engine intakes, and embarked on a crash redesign of the Yak-28P, called Yak-28-64, with fuselage mounted engines.
Performance of the Yak-28-64 was actually worse even than the production Yak-28P, and it had no chance of displacing the Su-15.
Regarding the Yak-28B/L/I series, the story is similar. Several advanced strike aircraft were under development, like Tupolev's "132" transonic low level bomber, and Yakovlev projects like Yak-35MV. These were cancelled in the late 1950s/early 1960s, and only modifications of existing types were to be considered. Su-7B & Yak-28 were regarded as already completed; therefore they entered service. Neither was entirely satisfactory, and production numbers of both were limited by Soviet standards.
Yak-28 production was very difficult; reliability was poor, the avionics seldom worked, and production kept changing through the production run with 10 different versions in total. Yak28B/BI were built in small numbers only. 111 Yak-28L were built, but the Lotos datalink bombing system was next to useless. Yak28I with Initsiyativa radar was a little better, eventually, once the radar was debugged sufficiently to actually work, and 223 were built.
The Su-17 and (eventually) Su-24 supplanted it.
Perhaps "disastrous" is the wrong word; it did fly, mostly. I meant disastrous in terms of Yakovlev's standing with the armed forces, not really in terms of the aircraft themselves, which were merely obsolete in conception and unreliable in service. No Yakovlev proposals were taken seriously for years afterwards.
Regarding the Yak-36M/38, this was never an operational aircraft. It could be best described as the world's best ejection seat test environment, and helped the Russians to build a really first class ejection seat design in the K-36. The design was flawed by reliance on 3 engines all working at once, something that Soviet engine building technology of the time couldn't provide. Unable to get a custom engine designed, they had to reuse the engines from the MiG-23PD. Just like HSA found with the Harrier, the battle for VTOL to work was to squeeze enough power from the engines to actually lift a worthwhile payload as well as the aircraft. Despite the best efforts of BSEL & later Rolls-Royce, world leaders in engine design, the Harrier still struggled until the invention of STOVL. Yak-36M couldn't really manage it, and the design made short takeoffs less useful than to the Harrier, not least because of the tiny wing sized for minimum weight not lift. It barely lurched off the deck with full internal fuel and a rocket pod under each wing; the idea of it carrying external fuel as well just makes no sense. Yak-38 squeezed enough extra power to make it work more reliably, but didn't fix any of the core problems.
The Russians were quite aware of this, but it gave Yakovlev something to do and gained Navy pilots flying experience (mostly in how to eject, of course).
The Yak-41M is not really much better. It stuck with the same basic powerplant idea, but newer engine technology gave more thrust, which is good. Unfortunately, as they found, vectoring a jet engine in full afterburner downwards results in lots of heat, which is bad, and nasty things happen to the aircraft underbelly if its made from, say, aluminium. If you look at the belly of the Yak-41M it looks like they've scabbed on some steel plating to compensate.Not to mention the state of the runway afterwards. Even the deck of an aircraft carrier could find the experience wearing.
It had the dead weight of 2 lift engines occupying internal space better used for, say, fuel. Yes, it was supersonic, but its aerodynamics weren't exactly going to put Sukhoi/Mikoyan out of the fighter business (tiny wing!). It still had a LOT of work to do to get to a viable operational system when the USSR collapsed.