Welcome to the forum mate!
Sorry to hear you’ve had some issues.
As you say, it’s almost definitely a set up issue with the limit screws. Cable will no doubt need adjusting to some degree too.
Not the end of the world but I get your frustration.
I’ve had some expensive bikes give similar issues right out of the shop over the years.
It’s one essential piece of fettling you need to know how to do yourself at some point. Even if set up perfectly once cables stretch and things bed in the shifting will go out of kilter at some point. That’s forgetting mud and normal wear and tear.
Definitely not sticking up for shoddy PDI’s but I’ve set up gears on a bike stand that shift to perfection only to find they behave totally different under load when being ridden.
That said,I will always tend to have the limit screws set in a little “pessimistically” initially to make double certain it doesn’t throw the chain off. I then let the limit screws out a little at a time as necessary, adjusting indexing as needed till shifting is precise and reliable with the chain still behaving itself.
Plenty of guides and videos online about it. Everyone does the adjustments slightly differently but the fundamentals are the same.
Good luck with getting the bike sorted. I don’t own one but it’s a great bike for the money by all accounts!