This has already been done. Although, the data set used wasn't the best, so the results weren't exactly spectacular. If someone ever feels like sitting down and creating a list of what tiles can be placed next to what other tiles, then we have code to do this.
Keep in mind there are 4 directions in which you can consider tiles to be adjacent, and there are about 2000 tiles in the tileset. It's a bit of work to make a complete list of what can go next to what, although somewhat possible for someone to do.
As a side note, the original data set was generated by scanning the original maps to see what tiles *have* been placed next to what other tiles. But there are a significant number of errors in the original maps. It seemed a lot of those not quite right tiles were selected during tile placement.
I had another idea to somehow use the data from the tile groups found at the end of the map files, but never got around to it. I suppose it can be automated to some extent, but I suspect it's going to amount to someone sitting down and going through a ton of possibilities.