This "cardinal rule" is a myth that needs to be put to rest. It makes me think of This is the sort of English up with which I will not put!
I wouldn't say "To whose dog does this ball belong" is ungrammatical (just awkward), but "Whose dog does this ball belong to?" is much more natural and idiomatic.
From a blog article at oxforddictionaries.com:
...there are four main types of situation in which it is more natural to end a sentence or clause with a preposition:
- passive structures (she enjoys being fussed over)
- relative clauses (they must be convinced of the commitment that they are taking on)
- infinitive structures (Tom had no-one to play with)
- questions beginning with who, where, what, etc. (what music are you interested in?)
(Grammar myths #1: is it wrong to end a sentence with a preposition?)