I am curious to understand the engineering and design principles behind this device, which I will refer to as the half-assed rest, because it seems to be an inferior design of a normal chair or bench. It seems to be designed explicitly to be hostile to the homeless by being designed this way, but perhaps I’m wrong in my assumptions about its intended function.
You are unfortunately most likely correct, and your description even grazed right by the official terminology for such things: hostile design/architecture.
As other answers have mentioned, such a design has some benefits. However, given that hostile architecture is a formal policy in many cities, I'd wager these benefits are more of a post-hoc rationalization, with the actual intent being to discourage their use by homeless people.
Sometimes concerns such as discouraging use of the bench for purposes such as loitering or being taken over by homeless guide the design.
Also it is hard to leave a possible hazardous package on the bench covered by a rag. And if they are left somewhere on the ground it will catch the eye.
This is an efficient way of temporary comfort for a passenger till their ride arrives.
Unfortunately in many metropolitan areas the problem of homeless people is spilling over into parks, parking lots, sidewalks.