Couple of thoughts.

Theory is useful to analyze a song to reverse engineer how/why it might have been written.

Most great songwriters do NOT think about theory when composing a song.

Why does a particular progression sound right even when it violates the "rules"?
The reason is often contextual.

I believe in the case you mentioned here it's because the only thing you are changing is the chord quality from dominant to major. So the intervallic structure is still there.

In pop music it's usually pretty easy to break the rules and have it sound fine. More importantly, it's pretty obvious to the ear if something doesn't sound right. If you were doing something more complex harmonically it would be more difficult.

Personally, I would learn enough theory to write the kind of music you want to write. Far too many people get so caught up in the theory. Theory is the least important part of music. Making a unique emotional expression is at it's core.