Yes, it does matter, and yes, it does matter in an actual battle (example in the end).
It is because attack more heavily impacts the CP than defense or HP. See for example the answer here, with the formula:
CP = (Base Atk + Atk IV) * (Base Def + Def IV)^0.5 * (Base Stam + Stam IV)^0.5 * Lvl(CPScalar)^2 / 10
What happens with a higher attack, is that your level cannot get as high to still stay under 1500CP, and that results in a lower total stats. This is also depicted in your example, where a perfect (15/15/15) IV Alolan Raichu only reaches level 22.5, whereas the perfect PvP (1/15/15) IV can go to level 24.5. This results in a Stat Product (that are all stats multiplied with each other) of that is lower for the perfect (15/15/15) IV vs perfect PvP (1/15/15) IV. This Stat Product is a made-up metric, but it shows you the relative potential of a certain species very well.
To demonstrate it really could make a difference, compare these two battles:
Battle Perfect (15/15/15) IV
Battle Perfect PvP (1/15/15) IV
In the first case, you lose against a Magnezone. The second one, you win, with 1HP left. The difference in defense and HP was enough to keep it alive.
Sidenote, it does not always guarantee it's better. Even so, if you simulate the perfect (15/15/15) IV vs perfect PvP (1/15/15), the perfect (15/15/15) IV will win. This is because when two Pokémon use a charge move at the same time, the one with a higher Attack stat uses its charged move earlier, making the latter one faint.
EDIT:
As noted in the comments, the moves have been updated, so I needed to find a different battle. I found one, where a Seadra is battling an Alolan Raichu:
Battle Perfect (15/15/15) IV
Battle Perfect PvP (1/15/15) IV
In short, the Perfect IV looses (Raichu has 6HP left) and the Perfect PvP IV wins (and Seadra has 1HP left).