Say I had a piece of JavaScript that did something pretty simple, light DOM manipulation, perhaps. Is there a way I could add this to Chrome (or any browser) so that it'll run every time I hit a defined, public site that I don't own (e.g. stackoverflow.com)?
A userscript can do this for you. You'll need a userscript manager like Tampermonkey.
For example, the following userscript will log hi every time I visit example.com:
// ==UserScript==
// @name My Userscript
// @description <Put something here>
// @include /^https://example\.com/
// @grant none
// ==/UserScript==
console.log('hi');
DOM manipulation and pretty much logic you could think of and implement is possible too.