Two things: this isn't a compound sentence ('a friendly creature in attacking a creature' is a fragment) and it is more accurately a prepositional phrase (so not a subordinate clause which is dependent on the main clause).
Prepositional phrases clarify the relationship of the subject with the clause within the phrase. The target creature is neither the subject of the sentence nor the nested subject of the main clause (that would be 'friendly creature'). Absent any structural or syntactical evidence that the focus of the sentence changed to the nested subject, we can determine that the propositional phrase supports the sentence's subject, and not the clause's subject.
Or simply put, as previously mentioned, both clauses (main and prepositional) support the sentence subject. The simplified rule is propositions modify subjects.
I, um, what? You just rewrote a large chunk of English grammar.
Firstly, yes, no argument that 'a friendly creature in attacking a creature' is a fragment. I mean, I agree, but I wonder why you chose to point that obvious fact out. I didn't claim it wasn't, nor did anything I said require that it wasn't a fragment. My argument, in general, was agnostic to the fragment status of that quote.
Secondly, yes, it's not more accurately a prepositional phrase, it's just straight out a prepositional phrase. We are in agreement. Sadly, all agreement stops right here.
I have no idea who taught you about prepositional phrases, but you need to go beat them with a heavy book, preferably one on grammar. Prepositional phrases modify nouns or verbs, which may or may not be in the subject of a sentence. For example, "The switch
on the wall was off." The prepositional phrase, "on the wall" modified the subject of this sentence. Example 2: Will you turn off the switch
on the wall? The prepositional phrase here modifies the
object of the sentence. Example 3: He turned the switch off
with alacrity. Here the prepositional phrase is "with alacrity" (it means with brisk and cheerful readiness) and it modifies the verb of the sentence,
turned.
So, now that we've dispensed with the notion that prepositional phrases only modify subjects (I don't even), we can look at the nouns and verbs in the sentence and identify the possible targets of the prepositional phrase:
"Alternatively,
you can
aid a friendly
creature in
attacking a
creature within 5 feet of you."
Bold words are nouns, pronouns, and verbs, italics in the prepositional phrase in question (actually, it's two phrases, "within 5 feet," and, "of you").
This is a bit of a complex sentence. "You" is clearly the subject. "Aid" is clearly the verb. I'm going to submit that 'a friendly creature' is clearly the subject. This makes the nice statement "... you can aid a friendly creature." That's a sentence all right! Now it gets tricky, because the last half of the sentence is really
three (yup, three) prepositional phrases, and they might even be nested.
The last half of the sentence is "...in attacking a creature within 5 feet of you." The first prepositional phrase is 'in attacking a creature." This is modifying the verb "aid" by describing how you aid. The next two are "withing 5 feet" and "of you". These are nested, as the "of you" is modifying "5 feet". The question, though is whether or not this phrase is modifying the 'a creature' in the prepositional phrase in front of it, or if it's modifying "a friendly creature." Ah, the glories of English and it's imprecision. Regardless, we know that it either has to be you within 5 feet of a friendly or of the target creature.
'You can aid within 5 feet of you' is a valid sentence able to be parsed: subject -> predicate -> proposition -> clause -> nested proposition -> nested clause.
Okay, I had to read that a few times to gather what you're saying, and I think it's that you parse that sentence as:
"You (subject) can aid (predicate) within (preposition) 5 feet (clause?) of (preposition) you (nested clause?)"
Is that right? Because, yeah, go beat the person that taught you that. If I just drop 'clause' from your statement, it reads better, as in "You (subject) can aid (predicate) within 5 feet (preposition) of you (nested preposition)." That works, but in that case the nested prepositions are modifying 'aid' as an adverb, and you still don't know who you can aid. There's no object to aid. You just can randomly aid within 5 feet of you?
Look. I appreciate that you're trying to make this obvious, but go review your English notes a bit first before you come back and have a discussion in which you say that prepositions can only modify subjects. That's trivially easy to prove false with Google, the word 'prepositions', and 20 seconds.