The "$" is just a valid character in a variable name. You could even create a variable "$$$"!
I've made it a habit to prefix variables with "$" when they reference DOM elements (or D3 selections, when I'm working with D3). There's no special meaning to it otherwise.
Be careful with your phrasing: replaceWith() does not reassign. Calling replaceWith is equivalent to:
$button.parentNode.insertBefore($wrapper, $button);
$button.remove();
Promise.resolve(): If you're not sure wether a value will be a Promise or something more basic (like a number or a string), you can pass it through Promise.resolve(). It will always return a promise which we can *await*, or call .then() on.
We need to make sure that the value is resolved before passing it to the Inspector. Otherwise the output would just be "Promise {}".