I have miscalculated the chain length and removed two necessary links on my chain. I have a spare masterlink. Would it be safe to use two masterlinks on a chain or do you recommend to re-attach the link with a rivet?
Assuming an well adjusted drivetrain, it's not more "unsafe" than using one: the strength of a chain is defined by the strength of its weakest link. If you use two master links, one will be a bit weaker than the other one: a chain with two master links will be as weak as a chain with the weakest link of the pair.
The only "but" I would mention is if you ride in environment such as forests, where some objects (branches in particular) can get into the drivetrain, and there having two weak points of one can make a difference, but outside that context, I wouldn't worry.
In terms of shifting performance, a masterlink will be also better than a poorly mounted additional link: it you don't manage to get the distance between the plates perfectly right, it has an impact on performance as well (for example too tight, the link won't move freely and you'll have a "click" at each chain revolution when it's going through the derailleur).
Note that if it's your concern is being stranded, there's an easy fix: you can take a set of spare master links with you, it weights nothing and you don't need tools to install a pair. (Generally speaking, I don't think it's a bad idea to take some if you have a chain tool in your saddle kit, replacing a broken (outer) link by a master link is more convenient than cutting the chain and shortening it.)
During the pandemic in 2020, people were on lockdowns and clamoring for entertainment. Seth of the YouTube channel Berm Peak Express collaborated with Competitive Cyclist to demonstrate that a SRAM chain where all the outer links were replaced by their quick links shifted more or less just like an ordinary SRAM chain. To emphasize, this is every single outer link.
I vaguely recall that there was a shortage of Eagle quick links during the pandemic. Did Seth and Competitive Cyclist cause this single handedly? We will never know.
Nevertheless, the findings almost surely generalize to other chains. I did the same thing you did with a Shimano 11s chain, and I have two quick links on it. Quick links may not be as strong as regular links, but they are strong enough for riding. Most of the 11 and 12s links snap closed very strongly, and I would have absolutely no worry about them.
I have personally ridden my recumbent with 6 master-links in the chain and it works fine.
This is a ~270 link chain, and three were simply from assembling it from three normal-sized bike chains.
Then three more were added when I removed some damaged sections after an unrelated accident. That chain did another ~3000 km and is still on the bike today.
A common road-side repair for a broken chain is to replace the bad link with a master link. I've had to do it a couple of times in the past 30 years. I think it's perfectly fine to have multiple master links in a chain.
I recommend using a master link tool to ensure they are fully seated. The Parks MLP-1 or 1.2 are both suitable as are tools from other manufacturers.