As I'm sure you know, the classic example is 'The Difference Engine' [0] by Gibson and Sterling, but my favourite is 'The Thrilling Adventures of Lovelace and Babbage' [1] by Sydney Padua, which features the eponymous characters as a crime-fighting duo, assisted by appropriate automation. It also features Isambard Kingdom 'You look like you need an Engineer' Brunel.
[0] https://en.wikipedia.org/wiki/The_Difference_Engine
[1] https://en.wikipedia.org/wiki/The_Thrilling_Adventures_of_Lo...
It's interesting to think that relays were an inherent part of all long range telegraphy (Morse's patent is 1840 and there were predecessors), but it took until the 1930s to start using relays to build electromechanical digital computers. The manufacturing technology would take a long time to catch up, but Boolean logic and electricity could have conceivably met a century earlier. (Edited 1940s to 1930s)
Early relays were big, not very reliable, and had too many adjustments. Early attempts at Teletype machines (the Teletype Model 12) worked the way you'd expect, with a rotating commutator and relays for the serial to parallel converter. Relay timing was not consistent and was a source of errors. The big breakthrough came when Howard Krum figured out how to make a mechanical serial to parallel converter in the mid 1920s. That was much easier to adjust, because all the timing came from cams driven by a motor. So everything was in sync. Teletype liked that design so much they stayed with it until the 1950s, then switched to a different all-mechanical design. Unfortunately, they stayed with all-mechanical too long, through the 1960s, and got left behind.
Most early phone exchange systems, and IBM tabulators, involved camshaft-driving timing. An IBM tabulator was mostly camshafts and clutches. It wasn't until after WWII that all-relay systems, such as #5 Crossbar, finally displaced telephone switches with driveshafts. Bell Labs developed wire relays with redundant contacts that required no field adjustments.
Railroad signalling went all-relay earlier, but they didn't need compute speed.
What I meant was that it seems surprising, from a modern perspective, that it never seems to have even been proposed until much later. There are some early hints: I recalled a mention in Gardner's "Logic Machines and Diagrams" of an early (1880s) electromechanical design by Allan Marquand [0], who had built several mechanical logic machines. But Gardner wrote that there wasn't anything published on switching circuits as logic until 1910 in a review by Ehrenfest [1], and it wasn't developed until several independent publications in the 1930s, most influentially by Shannon. By then switching circuits had already gotten very complicated in practice.
[0] pg 112 https://archive.org/details/logicmachinesdia00mart/page/112/...
Alonzo Church uncovered a diagram by Marquand of a logic machine using relays [2], but it seems to have been sequential, using the relays as memory of what hadn't yet been disproven [3]. In 1886 Charles S. Peirce wrote to Marquand mentioning that electrical circuits could be used for Boolean addition and multiplication [4], though it doesn't seem he was thinking about relays, and I don't know that this was ever applied.
[1] pg 138, reference 2 https://archive.org/details/logicmachinesdia00mart/page/138/...
[2] Mays "The first circuit for an electrical logic-machine" https://archive.org/details/sim_science_1953-09-04_118_3062/...
[3] Patterson's review of Mays, https://doi.org/10.2307/2964205
[4] https://electronics.stackexchange.com/a/321534 , it seems clear to me that Peirce was talking about manual switches, not relays as the answer seems to suggest.
[1] https://en.wikipedia.org/wiki/Cooke_and_Wheatstone_telegraph