Two things. First, your regex is like this:
'(\[([a-z]+?)\](.+?)\[\\\1\])'
You don't want to escape the slash before the 1, otherwise you are literally searching for "\1" rather than the backreference. So that should be:
'(\[([a-z]+?)\](.+?)\[\1\])'
Also:
function ($matches) {
You try to refer to $shortcodes
in your function. However, that is defined outside the function, so it has no access to it. You must explicitly pass any non-global variables to a function. When dealing with an anonymous function like this, use the use
instruction, so your function definition should look like this:
function ($matches) use ($shortcodes) {
Making those two simple changes gave me this output:
<button>Hello</button>
<input type="text" value="holololo">