Québec and Montréal came to develop different identities overtime. But to give you an idea of the change, in the early days of confederation, Québec city was about 40% English-speaking. Nowadays? 97% is French-speaking! Montréal was similar trend-wise although I don't have the estimates for the 19th century in terms of numbers. Nonetheless, at least until the end of the 1990s, there was a decline of English-speakers in the province as the province started and eventually cemented its own identity.
I will focus on how Montréal and Québec developed their distinct identities from there on. That is, Montréal being more of a cosmopolitan city and Québec city being more of a "national" city.
Some countries, when founded, choose where their capitals are located. I can think of the United States, Canada or Brasil, for example. All of them took a decision in regards to where the capital and administrative centre of their government would be. Similarly, the European Union would be a good example of that, where they picked Brussels, Strasbourg, and Luxembourg. Contrast it with something like Paris or London where it kind of became that way organically. That being said, there already was an economy and city in those places so government offices was just "adding" to the existing landscape.
Why is this important? Well, when those cities were picked, the local economy was not particularly developped. In the case of Ottawa, English-speakers set fire to the parliament in Montréal and it was after that it was decided that it should be between Ontario and Québec as to appease both factions. Ottawa was at that point called Bytown and was a trade hub, major for the wood trade but generally speaking was more of a crossroad for trade than an important city.
This means that Ottawa has a particular demographic makeup: government-based economy, highest median salary per family, most educated city in Canada. Something similar is observed in DC (highest median family income after San Francisco). This usually means that the economy is *inward* looking. That is, the requirements to work will be specific to the country rather than the international markets expectations of culture.
What do I mean by that?
Québec used to be a major commercial city. The English were doing a lot of trade there. But as time went on, trading was less and less with Europe and increasingly with the United States and English Canada. Montréal built port infrastructures and overtime, trade moved West. The movement would countinues overtime where the economy would move westward (you can read more about it here, something I previously wrote), to the benefit of Toronto. But the requirements of Montréal in terms of economy meant that it became a more cosmopolitan city due to its contact with the rest of North America and kept a signficant portion of anglophones there, which eventually would make it easier for immigrants to integrate if language was ever an issue. Usually, it was not Québec that was presented to them but Canada. In return they would see it as trying to integrate Canada by speaking English and only later did French become somewhat more of an integration matter. I am simplifying quickly of course; some immigrants from other parts of the world (such as french-speaking Africa or Haiti) would be closer to french-speaking communities or the Irish, which, due to their catholic roots, were better integrated with the french-speaking Québec population.
So the importance of trade meant that Montréal was a particularly important city for those who wished to work as most jobs were increasingly moving there.
But Québec city had and has jobs. But as it was focused on the province rather than the needs of the world markets, it meant job expectations were different. Let us look at one example: Hydro-Québec.
I wrote in the past about Hydro-Québec on here. Hydro-Québec is a state agency in charge of managing electricity in the province. Whereas electricity used to be managed by the private sector, Hydro-Québec bought them all (nationalisation). This had a direct impact: it allowed French-speaking engineers to find good, reliable work in their own language. It is only an example but basically, Québec city, as the administrative centre, was able to develop a particular French-identity focused on the civil servants need to speak French. Government work became a vector for the rise of a French-speaking middle class as nations in the West were increasing their welfare state policies.
This divergence meant one thing: Québec as a French city became instrumental in the construction of Québec identity and modern government whereas Montréal was turned towards the needs of international trade.
There are of course other factors (Québec was more rural, etc.) but of those unique to Québec, the provincial dynamic within the context of North America meant that Montréal developed a very different identity.
Now, it does not mean that Montréal was not nationalist or “Québécois”. It means that overtime, Montréal shifted gradually toward its cosmopolitan status that we see today and its role in Québec history was different. For example, union movements were particularly important in Montréal due to the various factories. Montréal had to set its priorities in face of the English and its place in rising stage, including defence of the French language. If many would not have seen cosmopolitanism as part of Montréal identity of Québec identity, the roots of the francophones as part of a labour class meant that Montréal would always be at the crossroad of international influence and its identity. Although national movements are much weaker in Montréal nowadays, historically, it was where the necessity of affirmation was the strongest. Québec city on the other hand, would be where the welfare state would be built and where its government elite would work at building the modern Québec state. In other words, whereas Montréal had to deal with the place Toronto would occupy in the market (companies dictating labour from Toronto for example), Québec was built on ensuring that powers would be left to Québec and government workers hired in Québec rather than Ottawa.
Without going into the 20 years rule, you do see the movement towards today where you’d be able to see that Montréal is trying to affirm itself on the world stage, even in its francophone iterations, whereas Québec is moreso focusing on ensuring the transition to a 21st century economy and ensuring Ottawa treats Québec a certain way.
Being French in Montréal meant to affirm the place of Québec on the world stage whereas in Québec city, being French meant ensuring having the control of our institutions. Although both goals overlap a lot, it meant that the identity of Québec is a lot more focused on Québec identity, quirks, and bureaucracy: keeping what we have and making it work over finding a place in the globalised economy.
Hopefully I answered your question! If not or if anything is unclear, do not hesitate.