Hello Kai,
thank you for your fast reply. It totally makes sense and that's what I've been trying out yesterday. Generally I had less issues when approaching a more perpendicular position as you said. It also became worse when my thumb had to rest on anything below the A string (like in this arpeggio) because I had to bend the fingers more to keep them planted.
I do have a relatively long forearm and fingers as well, so whenever I try to mimic the position of other players I feel the need to raise my right arm and shoulder a bit so I don't have to angle my hand too much to arrive at a perpendicular position that isn't too low either. My arm still rests on the guitar body then, but only around the arm bend. I don't know if that is considered bad technique though, because it might create extra tension in the arm and shoulder?
Edit: I experimented a bit with it. So it's definitely not just my angle but also how high I position my hand. If it's higher, I have no issues with muted strings. I need to pull my arm up a little for that, but it also prevents me making a very bent "claw" shape, so it gives the strings more room to vibrate.
Edit #2: After testing around some more, it might actually be more comfortable for me to play in classical guitar position instead and I saw videos of Sabicas doing that as well. Is that something you would suggest to avoid for Flamenco? It's how I always played the electric guitar as well.