*Puts hand up* Yep I've dealt quite a bit with stifle lock.
It is common on young horses, and often they will just grow out of it. Also in horses that lack muscle around the hindquarters, and also lack of weight around the hind quarters.
The worst case of stifle lock I've dealt with was similar to what's happening with your horse. Mine was a 3 yr old ottb mare. She'd just been let down so was in pretty average condition, very little muscling and very ribby. She was terribly foot sore so she was left in a deep sand yard for a week to let her recover. Well the lack of movement triggered stifle lock and she had it terribly. As with yours, walking her back didn't help much at all, and often she physically could not walk backwards anyway.
Got the vet out, and he recommended firstly pumping food into her. I'd been slowly feeding her up, but he said to give her a shot of vit. B12 and just stuff it into her to get weight on her quickly. Then to paddock her 24/7. Our paddocks are very slopey and he said fantastic, the slopier the better to strengthen her hindquarters and keep her moving.
Once she'd been pumped full of food and paddocked after a few more days in the yard, vet said to start working her in hand up and down a hill. So just walking her, twice a day in hand, up and down a big hill for 30 minutes a go.
This built up her hind end immensely and I was soon able to ride her through this hill work. Trotting and cantering is useless in this instance, the work has to be at walk.
I think she locked up maybe one more time after that a few months later, when she had run through a post and rail fence and smashed herself up pretty bad, so I HAD to yard for for some time and the lack of movement locked her up again.
To aleviate the locking if you can't back her up, you can press upwards with your whole hand, over the patella joint to push the ligaments back in place.
Essentially a locking stifle is caused by the ligaments running over the patella, displacing and this the joint cannot move. Over time, if not addressed it *can* cause arthritis, but being a young horse, I wouldn't panic too much.
DON'T DO SURGERY! The operation involves cutting the ligaments over the joint, so they can't lock anymore. This really is only a desperate last measure, as the horse will only remain sound for a couple of years after if you're lucky, so better for older horses who are going to be retired in the next couple of years anyway. The cutting of ligaments causes the formation of bone chips in the joint, and this causes arthritis in the joint. Most vets will try to steer you away from surgery.
I think there is also another surgery option, but it is a specialised operation and like the above option, not hugely successful in many cases.
So work work and more work for her. Build up that muscle and weight on her hind end, keep her moving. Don't yard/stable her, or do so as little as possible, and if possible, work her on hills.
Lunging is probably not the best idea, the tight circles can put too much strain on the joint and cause it to lock again. My mare would lock on the lunge if the circle was under 20m, fine on a bigger circle, but once we started collection with her she struggled to put an increased load on her hind legs. I'm not sure if it was because she anticipated that her stifle would lock and she'd fall over, or because it was painful for her. Either way, I decided that it was best to give up the dressage with her and sell her on as a pleasure mount.