Post-hyphenation of split compound words
Solution 1:
The standard way to deal with this in English is your second example, "off- or on-topic". Another example of where the hyphen would be preserved for both forms of the hyphenated word might be pre- and post-, e.g.
The pre- and post-match responses of the soccer fans were markedly different.