I don't get how it depends on "how it was written." First, Bach did write chords. Bar 2 of the famous Toccata and fugue ends in a chord. Bar 10/11 has a big chord. Bar 12 starts with a chord. There are chords everywhere. In case you doubt the authorship, plenty of other toccatas have chords. The whole idea of figured bass is chords.
Second, while they did think differently about harmony, you can describe it in modern terms. A description like Cmaj7 doesn't mean anything else than a set of pitches.
A tritone substitution is somewhat different, since it depends on what the analyzer thinks the chord could/should have been. There's a recent YouTube video (by David Bennett, IIRC) that shows tritone substitutions in songs, but he mentions that he doubts Paul McCartney knew he was writing one. But does that mean it isn't? No, it means you can see it as a tritone substitution.
Music theory is a subjective tool to describe and compare, nothing else.
It's interesting that you cite the Toccata and Fugue in D minor because some theorists believe that was actually written much later. The original theory was that Mendelssohn wrote it in the 19th century, but I believe there were some sources from the 1700s. It clearly has a very non-Bach character, including the octave doublings in the chords you mention.
It's very clear that the man wrote chords. It's also very clear that harmony (ie vertical music theory) was not the tool used to write those chords. If you listen to BWV903, for example, there is a long section of arpeggiated chords that defy 18th and 19th century harmony.
The OP's idea of a tritone substitution from Scarlatti does not have the same harmonic function as a tritone substitution in modern music. I would agree with you that if the function matches, you can certainly analyze things in the context of a later theory, but the function does not match.
Finally, figured bass notates intervals, not chords. A crude realization can neglect voice leading in the upper voices, but more skilled realizers of figured bass will preserve voice leading between the intervals in the upper voices. The idea that figured bass is about chords sort of maps backwards the modern abuses of figured bass (which IMO should not be taught as a "basic music theory" subject - but that is for another day) onto the original method.
I think this might be missing the point a little bit - the bassline in figured bass has more primacy than any of the sonorities above it. The most relevant feature of "chord"-based approaches to music (as found historically, e.g. in performance methods for the Baroque guitar, and to a far lesser extent in repertoire for the lute) is that the vertical sonority (such as "Cmaj7") is all that matters; individual "voices" or "parts" are of secondary importance at best. This maps well enough to how lute- or guitar-like instruments might be played in an accompaniment role (since these instruments obscure the sense of a "melodic line" or a "part" the most, for a variety of reasons) but music includes a whole lot more than that.
Second, while they did think differently about harmony, you can describe it in modern terms. A description like Cmaj7 doesn't mean anything else than a set of pitches.
A tritone substitution is somewhat different, since it depends on what the analyzer thinks the chord could/should have been. There's a recent YouTube video (by David Bennett, IIRC) that shows tritone substitutions in songs, but he mentions that he doubts Paul McCartney knew he was writing one. But does that mean it isn't? No, it means you can see it as a tritone substitution.
Music theory is a subjective tool to describe and compare, nothing else.