To be blunt, Harry wanted to keep his cake and to eat it. He wanted to continue being a Royal, with part-time duties on his own terms, after he and Meghan found they were a long way down the pecking order after Wills and Kate and their family.
When HMQ said “no” to that, and said that H&M had to be full-time working Royals being told what to do by his father and brother with little funding, or not at all with zero funding, they threw their toys out of the pram.
I think at that stage, after HMQ had lost her principal adviser with the death of Phillip, and with her now-known terminal illness, she was losing control of the Royal Family and was being firmly directed by Chaz and Wills in her decisions. Which Harry soon noticed when he was refused direct access to HMQ and so felt “betrayed”.
At that point, with Meghan’s prompting, he probably decided to give up his jostling for Royal position but had not yet realised the full and heavy consequences that baling out would mean. He was naive and has continued to be so in thinking that lashing out with his life story in retaliation would bring any real benefits. Apart from the many tens of millions of dollars, that is.