Get item's linked thing programmatically?

Whatever you are trying to achieve, it is likely some kind of kludge.

There are no simple tools for traversing the hierarchy. But if the GUI can do, so can you.
Remember that starting with an Item, the next step is the channel link - you can’t go directly to Thing. Remember also that this will be a List - Items may link to multiple channels.

The hierarchy is mapped out in internal registers, so that’s where you must look.
Old OH2 posts, but show the kind of methods -

Newer -

Keyword ItemChannelLinkRegistry