Yeah, that's just software mode being shit. It's had issues with rendering things in the correct order for over a decade. You'll notice the issue when encountering all kinds of level geometry. There's no known workaround or fix, despite many people taking a crack at it over the years. If it bothers you, I can only suggest using OpenGL instead, if possible.