You could have, but definitely have no obligation to do so.
There is an odd element to TTRPGs that I've noticed, in which many people want and expect their characters to be fundamentally well-suited to the in-game environment, sometimes in every dimension. There's definitely nothing wrong with that, but it can get a bit strange in specific segments of plot. Dramatic tension doesn't really come from encountering only challenges which your character is specialized to overcome.
In a game from the Legend of Zelda series, new challenges tend to arise when you get a tool designed specifically to deal with them. You won't find yourself in a mandatory dungeon with a hookshot puzzle before getting the hookshot, and that's a form of segmenting and gating content. It would be beyond frustrating for it to be otherwise, as it would be impossible to advance.
RPG characters are a bit different. If your deliberate, plan-loving character were, due to plot elements, forced into a situation where they had no time to plan and had to act now, how would you perceive it? Would you think
This situation fundamentally betrays my character concept. My character is a planner, and any instance where they can't plan is one that they would not accept, so neither will I. This game is only valid for this character if conditions always allow them to approach challenges in their preferred way.
or might it be more like
My character is well-rounded but adventuring in unpredictable scenarios. Sometimes conditions allow them to operate in their preferred way, and sometimes things will go sideways. That unpredictability and tension is interesting, and I can still play my character faithfully under adverse circumstances.
There isn't a wrong answer, but if you lean more towards the former then you may need a character that is designed to operate with the group's preferences. If it's the latter, then your character's preferences will be expressed (at least sometimes) in ways other than having things unfold as they would prefer.
Think of it this way: Why was your character adventuring with a pair of Leeroy Jenkinses?
Was it because there was a compelling plot reason that brought these individuals together, and they sometimes had to deal with differing preferences for approaching problems, adding a new element of challenge to approaching the game for everyone? Was there some plot goal that would drive your character to continue working with people that frustrate their usual methods?
Or was this to be a cadre of like-minded people seeking adventure because they naturally work well together, and they apply that teamwork to accomplish heroic feats?
It's mainly on the GM to provide story elements like that, but if those are absent then only you can decide what reasons your character might have for sticking with these more... spontaneous individuals, and if those reasons aren't good enough for you you can ask the other players to work with you to fix that, or change your character around to better suit the party as it is.
Beware "My Guy" syndrome
I'm not suggesting that this was in play here, but it's worth bearing in mind because extending this mindset too far leads to My Guy syndrome.
In short, you are not in any way constrained by what your character "thinks" or "would do". You are a player at the table, and you exist. Your character is an application of your imagination, and does not. By all means if you are not having fun with a character, for any reason, you don't need to carry on playing with that character.
But simply asserting that your character does not trust the group and therefore would definitely leave is working from the opposite direction. In real life people do things they'd rather not all the time, and not liking the approach of the party overall doesn't mean your character must, or even can, just take off and be replaced by someone else.
The problem was that you were not having the fun you wanted. Not that your character did or did not feel a certain way.
What could you have done?
This is a fuzzy question, since so much depends on the specific circumstances of your campaign and gaming group. But working with your GM and fellow players to come up with reasons why your character was involved with the party would have been a good first step. If he needs their help to free his imprisoned family from a wizard, he might put up with just about anything they might do because walking away means all of his goals are ruined.
Post-hoc options include things like pointing out to the party that the last time you rushed in, things went terribly and so this time you should try a more deliberate approach. Perhaps you could compromise with the other players to plan less than your character might prefer, but more than their characters might prefer.
Tension between PCs isn't necessarily bad. I like using it in games that I run. But especially if players are trying to be true to their characters, the incentives for them to stay together need to be stronger than the tensions driving them apart. Your GM is responsible for a lot of that, but you can do it yourself too. If you can't think of a reason your character would be a part of this group, you can talk to the GM and other players about it to help make things fit together better.