By which I mean transforming the British empire into a federal state with a parliament including representatives from all over the empire. Or possibly a more limited form involving just Canada and Australia.
It seems strange that such an idea was never considered as an alternative to be offered to the various parts of the empire wanting independence.
You would have thought that the British would have learned from the US "no taxation without representation" revolution.
The short answer is yes, there were some proponents for Imperial Federation.
I obviously can't offer an authoritative answer as to why this never happened, but I can touch on most parts of your question:
One thing that's key to understanding the British Empire of the 19th century onward is the presence of Responsible Government in most settler-colonies. By the mid-to-late 1800s, most settler dominated colonies (i.e. north america, Australia and New Zealand, southern Africa) elected their own colonial governments. The taxes they paid would have gone to the colonial state, not to Britain. These countries' paths to independence were gradual rather than an abrupt break from Britain.
My best explanation for why Imperial Federation never 'took' politically is that it would have meant a decline in relative power for both British and Colonial legislators, and that the existing system 'worked'.
I have mostly answered your question regarding 'a more limited form involve just Canada and Australia'. Re: the rest of the empire, political representation for non-Europeans was simply a non-starter. The non-self-governing, non-white colonies were treated quite differently from the largely autonomous settler colonies.
On a somewhat related note, France's colonial empire might interest you. France always took a more integrationist approach: some of its colonies actually did receive representation in the National legislature, with suffrage granted to Africans who were deemed "assimilated" into French culture. To this day, there are representatives from France's remaining overseas territories in the Assemblee Nationale (whereas Britain's remaining territories, while electing their own Governments, are unrepresented in Parliament).
It's not exactly the same thing, but during WWI there was an Imperial War Cabinet. It wasn't directly a parliamentary body, but the effect was to codify the fact that the major dominions and India gained a direct say in British foreign and defence policy. The longer term effect was to hasten the growing independence of the white dominions in particular.
In WWII when the it was proposed (by the dominions), it was rejected primarily because it was seen as a regressive step toward a more tightly integrated Empire. So you can see that the forces at play were driving the dominions toward greater independence and that the inclusion of the constituent parts of the Empire into British policy was simply a stepping stone along the way to eventual complete independence.
It's really quite a fascinating example of a largely peaceful and mutually beneficial separation. It's too bad that the entire British Empire wasn't dissolved this way.
This system was succeeded by the current Commonwealth.
To add another question to yours, would that even have been feasible if you were to A.) include all the Empire and B.) give it fair representation by population? Cus then the British Empire would become the Indian Empire. Unless of course there were stipulations thrown on top limiting non-British entities, or India was represented as it's individual 'nations'. Even then, it's possible Bengal and maybe a few other states might've had a larger population than Britain still.