Sorry, but I still do not totally understand it. The only angles the game can make are multiple of 45° (horizontal, vertical, diagonal). It means that for most end points combinations, the wall will not be finished.
Are you talking about something similar to the following gif (made with the CodePen tool, grey is the suggested wall position while maintaining the mouse left button) ?
In comparison, the first solution of the ‘Salamander algorithm’ (1. diagonal attached to the first point (then horizontal or vertical)) would give this:
This is the same scenario, but with the comparison to the game current implementation (yellow is the game current implementation, grey is the ‘Salamander algorithm’):
As can be seen, there is a huge flip of the L-shape direction when close to the diagonal, which is not the case with the ‘Salamander algorithm’.
A last point to consider is that there are two solutions for the diagonal solutions and also two solutions for the L-shape solutions, because there is a central symmetry.
An option to switch between these two symmetrical solutions can also be useful (and is currently missing, even for the L-shape solutions).
Here is an example where I try to finish the wall (grey squares) to surround the buildings (brown squares) with a minimal number of additional tiles (so only the diagonal solutions) but still while maximizing the area being surrounded. Depending on the terrain configuration, I choose one or the other symmetrical solution.
I agree that there are some rare situations where a L-shape wall would be the best solution (but for me it is way less than 30% ). This is why the two symmetrical L-shapes solutions are also integrated in the ‘Salamander algorithm’, but they are the last (i.e. third and fourth) solutions when switching between the solutions.
At the same time, I also agree with @blastonguart that it can still easily be achieved with the diagonals solutions: