I think one way to solve your problem is by defining smaller rules that are applied before your more specific rules. That way, you could do a replacement there that works for your edges, but it will also be applied wrongly to some non-edge cases, but that isn't a problem because later rules can correct those cases. You can enforce rule order by listing multiple rule files in your
Btw, your transition tiles look very suitable for use with the terrain tool. So you could consider using that instead of automapping.