There's a relatively quick way to do it manually: Move the Block and Text so that its [in this case] upper left corner lies anywhere along the left leg of the Polyline [in the image, I have already Moved them [the dashed blue is the original position] to put the Block's insertion point at the far left end, but you could put that location at the MIDpoint, or with a NEArest Osnap anywhere]. Draw a temporary Line along that left leg, and Move that [maintaining its angle] so that it passes through the [in this case] upper-right corner of the Block [the green Line here, already so Moved]. Finally, Move the Block and Text between the obvious INTersection points, and Erase the temporary Line.

To automate that could be very tricky. The Block in that skewed orientation is at 0 rotation, which makes it a lot harder to extract where that upper right corner is from its information, than it would be if the Block at 0 rotation were orthogonally oriented. The starting vertex of the Polyline in the Block is not at the Block's insertion point, and I can't imagine you could always count on that Polyline being drawn always from the same corner and always in the same direction, nor that the white Polyline would always be drawn in the same direction. And the Text is a separate object from the Block, so a routine would presumably also need to ask you to select that.
What are the "extreme" possibiliities here? Are your examples so far "typical" in the sense that the white Polyline will always be three segments falling toward the ends, and the rectangle will always be underneath in a similar original position? Or could there be significantly different starting conditions? More Polyline segments? Block above? The whole thing rotated in some very different orientation? Significantly different Block shape? Etc.
I suspect that coming up with a foolproof way to account for all possibilities would be a lot more effort than just doing it manually, but I wouldn't claim it can't be done. And it may be worth the effort, if you have a large enough quantity of them to process.
Kent Cooper, AIA