An interesting option is the ESP32 WROOM breakout board. This comes with wifi and bluetooth and a very powerfully MCU. More important is that it support wifi security, cost ca 3.5 USD and measure 18 x 25.5 mm in size.
If I use this as MCU I only need to worry about the H-Bridge, PSU and extension port. I probably could attach that as a piggy pack soldiered under the ESP32. The total package would be something like 6-7mm thick, but this could actually work.
ESP32 have an awesome dual core MCU running at 240Mhz with loads of IO. I have GPIO, ADC’s, DAC’s, SPI, UART, + more.
The best part is that this is supported through Arduino IDE allowing people to add their own code easy. An even more exiting idea is Bluetooth and if I could set up a ESP32 as a “sender” allowing the train to detect their own position – I also have 2 DAC’s that easily become 2 sound channels. Some interesting options/ideas here.