I echo what everyone has said about the vet visit. That should be the first check whenever a pet changes behavior like this.
I also wonder - does she have a "safe" place to go? I'm more used to cats than dogs these days, but most animals have the same instincts when they are afraid - to hide. When our cats get startled or afraid, they go under the bed. I'm wondering if some of the behavior you're seeing isn't her trying to find someplace to hide where she feels safe, and she can't find one.
I don't know how big she is, but is it a possibility for you to get something or set up something where she could "hide"? Thinking in terms of my cats - aside from under the bed, they have a "condo" at the bottom of their scratching post, and also a small teepee-style bed. The idea is that it should be something with only one opening that she can go into and know that nothing can come at her from behind/above, and she can guard the entrance.
If you have a crate for her, this would likely work - but I'd try also covering it with a blanket or something to make it feel more enclosed. Another thought would be a box big enough for her with only an opening just big enough for her to get into it.
I'd also make sure there is padding on the bottom of it so she doesn't get vibrations from the floor.
Definitely talk to the vet about her behaviors, especially the change in where/when she urinates/defecates. But it wouldn't hurt to try giving her a "safe" (from her perspective) place to hide like this too.