Yes, I know the english rule about the same cases. That's true.
However in russian lang. we can use two cases.
I do not remember the grammar rule, I am just trying to explain how I understand that.

1. Ей прошлось бродить, как [бродит кто? как вообще обычно бродит любая] бездомная собака.
2. Ей пришлось бродить, как [пришлось кому? так же как когда-то пришлось какой-то неизвестной] бездомной собаке.

Both expressions are acceptable. Common senses are equal.