I recall someone wrote a code to do that but i forgot to check back last year.
Shared database till fork then split into two separate directories such as ......roaming\btc and ....roaming\bcash from block 478558.
Nothing is impossible.
I agree with you, in the coding world anything is possible, but what you want no one has done it before. In this right moment is impossible, but will not be impossible forever.
So, for this you should need 3 blockchains, 1 for the blocks 0 to 478558, other for btc and other for bch. the btc and the bch should start from block 478559. And each node should work independently, they couldn't work together because if you call a command like:
bitcoin-cli getinfo
It should give the info for one chain and not from both.
I recommend you to take this conversation to
https://bitcointalk.org/index.php?board=6.0 (Bitcoin Forum > Bitcoin > Development & Technical Discussion) maybe they can offer a solution.
You got it.