Ever considered swapping them at a lower level (irrespective of the display server)?
There’s a great recent project at github called keyd. there’s also another one called cap2esc, but the latter is confined to the infamous swapping between cap and Esc key, whereas is the former has more generic use cases. This may not be addressing your very issue, but if you just want to “just work” , then this might come in handy.