Why "substrate" is exposed through a "do not connect" pin at all?
The back of the silicon chip (the substrate) needs to be physically mounted (soldered) to some part of the lead frame as part of the assembly process, before the wire bonding is done and the epoxy is molded around it. Leaving it unconnected is not an option.

Sometimes the substrate connection is brought out to the ends of the package, and then sheared off flush as part of the final trim after molding. Note the vertical rails that support the central chip platform in this 16-pin DIP lead frame.



(source)

However, in an optocoupler, chip platforms are required for both the LED and the triac circuit, and having this kind of central rail would probably compromise the amount of isolation that's possible. So they bring it out in both cases on an ordinary pin. This works for the LED, because that's how LEDs are constructed anyway. And it works for the triac because they didn't need that pin for anything else. Here's one example:



(source)