Right now it exists as a sprite, but not as an object with defined dimensions. I can clip through it if there's no wagon inside. Would it be possible to make the loader behave like other buildings and not let the player pass right through?
It is possible, and it used to be this way, but it means that a player can get permanently stuck inside a wagon underneath a loader in special circumstances (engine out of fuel, No Path, player inventory too full to mine the loader, etc.). There was actually a request early on to make BRLs work the way they do now: https://forums.factorio.com/viewtopic.php?p=337280#p337280
I see. If I were to change that for myself, what should I alter in the code? I don't ride wagons and would like to have the loader as a solid object for immersion reasons.