Loaches are very inquistive and love to squeeze into tight spots. They will actively swim against a current too. So he might have got in via the output. Might want to cover it with something. Even the bars that come on, say an Aqua Clear filter intake, are not tight enough to keep out a small loach, and if you ever removed the uptake tube to clean it, he may have got in then.
I once found two loaches in my Aqua Clear, fortunately alive and well, having bypassed the impeller somehow. And a pair of Celestial pearl danios one time, also alive and well, under the media basket. I now have a big pond prefilter on the intake and the output comes over the weir, so they can't get in that way. If I'm cleaning a tube I turn off the filter.
Sorry for the loss. It's always disturbing to lose a fish this way.