r will place the contents of the specified file in the output before reading the next line of input. Unfortunately you can't specify
0 as the address for this command, so there's no way to insert the contents of a file before the first line of input (without poking around with the hold space).
You could, however, just use plain old
cat. It is, after all, the command for concatenating files:
$ cat file1.txt file2.txt >out && mv out file2.txt
To be sure you're writing to a temporary file that does not already exist, one may use the
$ tmp="$(mktemp)" && cat file1.txt file2.txt >"$tmp" && mv "$tmp" file2.txt
This is slightly awkward on the command line, but a good precaution in any script that needs to write to a temporary file.