Regarding clicker training, the Kikopup channel on YouTube has a
good introductory video.
To start, it sounds like Loki is a bit anxious. I'm guessing it's a combination of inherent temperament plus the maltreatment he got during his puppyhood.
The reason I was asking about how you handled resource guarding is that anxiety can increase a dog's natural tendencies to guard their stuff. A big mistake people make when dealing with resource guarding is to play mind games with the dog. They barge in and take the dog's stuff away to prove some kind of point. Maybe the point is that dogs must submit to having stuff taken away. Maybe the point is to show the dog that humans will give stuff back. Whatever the point of the mind game is, what the dog takes away is a perpetual fear that he will lose his stuff. This makes the dog more anxious. It can also make the dog more likely to get weird and possessive over stuff that shouldn't normally matter to dogs, like used Kleenex or crumpled grocery receipts. It sounds like you dodged a bullet with Loki. His resource guarding tendencies weren't so bad that he got pushed into this extreme sort of resource guarding. Before doing any further work with the resource guarding, including trying to teach him the command Leave It, I would suggest reading a book called
Mine! by Jean Donaldson. Meanwhile, simply set up a safe zone where he can eat in peace and nobody bothers him.
Regarding his barking lunging meltdowns, this sounds like a mixture of nervousness and frustration. He might be nervous about meeting other dogs and people. At the same time, he might actually want the interaction. So he's nervous and possibly conflicted. Unfortunately, people have a tendency to focus on the symptoms, the barking and posturing, rather than the dog's underlying emotional upset. Especially since he was beaten so much as a pup, he probably does not yet trust his handler to be a protector. I would take a two pronged approach to this. One is to work on changing his feelings about other dogs and people. The other is to teach him a task he can perform when you need him to be calm.
A tangent here. In training, there is something called the three D's: Distance, Distraction, Duration. I'd assume Loki can hold it together when he catches a three second glimpse of a dog quietly walking a quarter mile away. All three Ds are favorable in that scenario: the dog is far away, the dog isn't doing anything interesting, and the dog disappears from view before Loki can get worked up. Any time you increase the difficulty of one of the D's, it's likely you will need to decrease the difficulty of at least one of the others.
There is also something called trigger stacking. What that means is that stress builds up each time a dog is exposed to a trigger. It's actually biological; things like cortisol and adrenaline get secreted in response to the trigger. These hormones take a while to dissipate, hours or even days. So perhaps Loki sees a strange dog in the morning. He stiffens but doesn't react. Then he sees a second strange dog. This time he has a screaming meltdown. The second dog didn't do anything different than the first dog. The difference is in Loki; he saw the second dog when he was already on edge from the first dog. And, having had the screaming meltdown, he may stay keyed up for the rest of the day or even into the next day. It's the stress hormones messing with his brain. He can't help it.
Back to barking and lunging. While you are working on this, try to avoid putting him in situations where he is rehearsing the aggressive posturing. Start by figuring out roughly how close the other dog or person can be before Loki starts reacting. It's quite likely that a barking dog or squealing running child (high distraction) needs to be further away than a quiet dog or human. He might need more distance if he's already been exposed to another trigger that day. Do your best to keep triggers outside Loki's reaction zone. That may mean you turn around and walk a different route. If he's already dealt with a lot of triggers, especially if he's had a meltdown, it might mean you forgo the walk and just sniff around in your own yard.
At home, and then on walks, teach him a couple of games he can play with you. I'm a huge fan of teaching Touch. Once he masters the basics of Touch, you can then use it to move him into positions around your body. You can teach him to come to your left heel, to your right heel, to get behind you, and to face you. It's a great way to get some fun clicker training in.
Once he is somewhat solid on Touch, Heel, Behind, and Face at home, try going out to a park or someplace where you will see people or dogs in the distance. When you see him looking, before he stiffens and much before he starts barking, whisper his name and give him a treat. He will probably eat his treat and start looking at the Big Scary again. Hopefully he glances back at you. The moment he does, give him another treat. Just sit there watching things and giving him treats while he remains quiet. You're quiet and calm, the Big Scary isn't doing anything weird, it's just a nice day in the park with lots of treats. If he starts to stiffen, ask for a Touch. Then ask him to move to the side of your body opposite the Big Scary. You are now body blocking him from the Big Scary. That should take some of the pressure off him. He doesn't need to worry about defending himself, because you are dealing with things. If he's still nervous, refusing to eat treats, or vocalizing, put the treats away and tell him Let's Go. Move away from the Big Scary until he feels safe again.