Dominic Cummings offered to help Jeremy Corbyn become prime minister before the 2019 general election, a new book has claimed.