You can't take separate two diodes and connect them back-to-back, because wire is in the way. When you connect two diodes in a circuit, that's not connecting the junctions back-to-back.
But if you take the PN junction of one diode, the NP junction of another, and then merge the N of one with the other, you have a PNP transistor. The level of doping in each layer matters, and that then (in part) controls what type of transistor[0] you get, but it is, honestly, two diode junctions. What you have done is to think about connecting diodes in a circuit, which is not the same thing at all.
[0] There are switching transistors and amplifying transistors. Then there are field-effect transistors which are another animal entirely. And more. But in essence, a PNP transistor or an NPN transistor, are each two diode junctions.